Text Generation
Transformers
Safetensors
English
sparsetral
llama-2
code
custom_code
Eval Results (legacy)
Instructions to use uukuguy/speechless-sparsetral-mistral-16x7b-MoE with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use uukuguy/speechless-sparsetral-mistral-16x7b-MoE with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="uukuguy/speechless-sparsetral-mistral-16x7b-MoE", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("uukuguy/speechless-sparsetral-mistral-16x7b-MoE", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use uukuguy/speechless-sparsetral-mistral-16x7b-MoE with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "uukuguy/speechless-sparsetral-mistral-16x7b-MoE" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "uukuguy/speechless-sparsetral-mistral-16x7b-MoE", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/uukuguy/speechless-sparsetral-mistral-16x7b-MoE
- SGLang
How to use uukuguy/speechless-sparsetral-mistral-16x7b-MoE with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "uukuguy/speechless-sparsetral-mistral-16x7b-MoE" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "uukuguy/speechless-sparsetral-mistral-16x7b-MoE", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "uukuguy/speechless-sparsetral-mistral-16x7b-MoE" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "uukuguy/speechless-sparsetral-mistral-16x7b-MoE", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use uukuguy/speechless-sparsetral-mistral-16x7b-MoE with Docker Model Runner:
docker model run hf.co/uukuguy/speechless-sparsetral-mistral-16x7b-MoE
|
Download README.md from uukuguy/speechless-sparsetral-mistral-16x7b-MoE: direct link, hf CLI and curl.
- Browser
- Download file 2.73 kB
-
https://huggingface.co/uukuguy/speechless-sparsetral-mistral-16x7b-MoE/resolve/main/README.md
- Command line
-
hf download hf://uukuguy/speechless-sparsetral-mistral-16x7b-MoE/README.md
-
curl -L -o README.md https://huggingface.co/uukuguy/speechless-sparsetral-mistral-16x7b-MoE/resolve/main/README.md
2.73 kB
| language: | |
| - en | |
| library_name: transformers | |
| pipeline_tag: text-generation | |
| datasets: | |
| - jondurbin/airoboros-2.2 | |
| - Open-Orca/OpenOrca | |
| - garage-bAInd/Open-Platypus | |
| - WizardLM/WizardLM_evol_instruct_V2_196k | |
| - TokenBender/python_eval_instruct_51k | |
| - codefuse-ai/Evol-Instruction-66k | |
| tags: | |
| - llama-2 | |
| - code | |
| license: llama2 | |
| model-index: | |
| - name: SpeechlessCoder | |
| results: | |
| - task: | |
| type: text-generation | |
| dataset: | |
| type: openai_humaneval | |
| name: HumanEval | |
| metrics: | |
| - name: pass@1 | |
| type: pass@1 | |
| value: | |
| verified: false | |
| <p><h1> speechless-sparsetral-16x7b-MoE </h1></p> | |
| speechless-sparsetral-16x7b-MoE is the MoE upgraded version of [speechless-code-mistral-7b-v1.0](https://huggingface.co/uukuguy/speechless-code-mistral-7b-v1.0). The MoE fine-tuning adopts [Parameter-Efficient Sparsity Crafting (PESC)](https://arxiv.org/abs/2401.02731), which is an efficient fine-tuning architecture that uses LoRA modules as expert models, similar to the concept of [multi-loras](https://github.com/uukuguy/multi_loras). The model size is approximately **10B**. | |
| Specifically, Mistral-7B-0.1 is used as the base model, with 16 experts and 4 expert outputs selected for inference. The fine-tuning dataset includes codefuse-ai/Evol-Instruction-66k to enhance the model's code generation ability. The specific datasets are as follows: | |
| - jondurbin/airoboros-2.2: Filter categories related to coding, reasoning and planning. 23,462 samples. | |
| - Open-Orca/OpenOrca: Filter the 'cot' category in 1M GPT4 dataset. 74,440 samples. | |
| - garage-bAInd/Open-Platypus: 100%, 24,926 samples. | |
| - WizardLM/WizardLM_evol_instruct_V2_196k: Coding coversation part. 30,185 samples | |
| - TokenBender/python_eval_instruct_51k: “python” in output .40,309 samples | |
| - Spider: 8,659 samples | |
| - codefuse-ai/Evol-Instruction-66k: 100%, 66,862 samples | |
| ## Alpaca Prompt Format | |
| ``` | |
| ### Instruction: | |
| <instruction> | |
| ### Response: | |
| ``` | |
| ## Usage | |
| ```python | |
| from transformers import AutoModelForCausalLM, AutoTokenizer | |
| model_name_or_path="uukuguy/speechless-sparsetral-16x7b-MoE" | |
| tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, trust_remote_code=True) | |
| model = AutoModelForCausalLM.from_pretrained(model_name_or_path, device_map="auto", trust_remote_code=True).eval() | |
| system = ""Below is an instruction that describes a task.\nWrite a response that appropriately completes the request.\n\n"" | |
| prompt = f"{system}\n\n### Instruction:\n{instruction}\n\n### Response:" | |
| inputs = tokenizer(prompt, return_tensors="pt").to(model.device) | |
| pred = model.generate(**inputs, max_length=4096, do_sample=True, top_k=50, top_p=0.99, temperature=0.9, num_return_sequences=1) | |
| print(tokenizer.decode(pred.cpu()[0], skip_special_tokens=True)) | |
| ``` | |