Text Generation
Transformers
Safetensors
English
phi-msft
Mixture of Experts
nlp
code
cognitivecomputations/dolphin-2_6-phi-2
lxuechen/phi-2-dpo
Yhyu13/phi-2-sft-dpo-gpt4_en-ep1
mrm8488/phi-2-coder
conversational
custom_code
Instructions to use mlabonne/phixtral-4x2_8 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use mlabonne/phixtral-4x2_8 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="mlabonne/phixtral-4x2_8", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("mlabonne/phixtral-4x2_8", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use mlabonne/phixtral-4x2_8 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "mlabonne/phixtral-4x2_8" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mlabonne/phixtral-4x2_8", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/mlabonne/phixtral-4x2_8
- SGLang
How to use mlabonne/phixtral-4x2_8 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 "mlabonne/phixtral-4x2_8" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mlabonne/phixtral-4x2_8", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "mlabonne/phixtral-4x2_8" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mlabonne/phixtral-4x2_8", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use mlabonne/phixtral-4x2_8 with Docker Model Runner:
docker model run hf.co/mlabonne/phixtral-4x2_8
Update config.json
Browse files- config.json +7 -23
config.json
CHANGED
|
@@ -1,50 +1,34 @@
|
|
| 1 |
{
|
| 2 |
-
"_name_or_path": "
|
| 3 |
"activation_function": "gelu_new",
|
| 4 |
"architectures": [
|
| 5 |
-
"
|
| 6 |
],
|
| 7 |
-
"attention_dropout": 0.0,
|
| 8 |
"attn_pdrop": 0.0,
|
| 9 |
"auto_map": {
|
| 10 |
-
"AutoConfig": "
|
| 11 |
-
"AutoModelForCausalLM": "
|
| 12 |
},
|
| 13 |
-
"bos_token_id": null,
|
| 14 |
"embd_pdrop": 0.0,
|
| 15 |
-
"eos_token_id": null,
|
| 16 |
"flash_attn": false,
|
| 17 |
"flash_rotary": false,
|
| 18 |
"fused_dense": false,
|
| 19 |
-
"hidden_act": "silu",
|
| 20 |
-
"hidden_size": 4096,
|
| 21 |
"img_processor": null,
|
| 22 |
"initializer_range": 0.02,
|
| 23 |
-
"intermediate_size": 14336,
|
| 24 |
"layer_norm_epsilon": 1e-05,
|
| 25 |
-
"
|
| 26 |
-
"model_type": "mixtral",
|
| 27 |
"n_embd": 2560,
|
| 28 |
"n_head": 32,
|
| 29 |
"n_head_kv": null,
|
| 30 |
"n_inner": null,
|
| 31 |
"n_layer": 32,
|
| 32 |
"n_positions": 2048,
|
| 33 |
-
"num_attention_heads": 32,
|
| 34 |
"num_experts_per_tok": 2,
|
| 35 |
-
"num_hidden_layers": 32,
|
| 36 |
-
"num_key_value_heads": 8,
|
| 37 |
"num_local_experts": 4,
|
| 38 |
-
"output_router_logits": false,
|
| 39 |
"resid_pdrop": 0.1,
|
| 40 |
-
"rms_norm_eps": 1e-06,
|
| 41 |
-
"rope_theta": 10000.0,
|
| 42 |
"rotary_dim": 32,
|
| 43 |
-
"router_aux_loss_coef": 0.001,
|
| 44 |
-
"sliding_window": null,
|
| 45 |
"tie_word_embeddings": false,
|
| 46 |
"torch_dtype": "float16",
|
| 47 |
-
"transformers_version": "4.
|
| 48 |
-
"use_cache": false,
|
| 49 |
"vocab_size": 51200
|
| 50 |
-
}
|
|
|
|
| 1 |
{
|
| 2 |
+
"_name_or_path": "mlabonne/phixtral-4x2_8",
|
| 3 |
"activation_function": "gelu_new",
|
| 4 |
"architectures": [
|
| 5 |
+
"PhiForCausalLM"
|
| 6 |
],
|
|
|
|
| 7 |
"attn_pdrop": 0.0,
|
| 8 |
"auto_map": {
|
| 9 |
+
"AutoConfig": "configuration_phi.PhiConfig",
|
| 10 |
+
"AutoModelForCausalLM": "modeling_phi.PhiForCausalLM"
|
| 11 |
},
|
|
|
|
| 12 |
"embd_pdrop": 0.0,
|
|
|
|
| 13 |
"flash_attn": false,
|
| 14 |
"flash_rotary": false,
|
| 15 |
"fused_dense": false,
|
|
|
|
|
|
|
| 16 |
"img_processor": null,
|
| 17 |
"initializer_range": 0.02,
|
|
|
|
| 18 |
"layer_norm_epsilon": 1e-05,
|
| 19 |
+
"model_type": "phi-msft",
|
|
|
|
| 20 |
"n_embd": 2560,
|
| 21 |
"n_head": 32,
|
| 22 |
"n_head_kv": null,
|
| 23 |
"n_inner": null,
|
| 24 |
"n_layer": 32,
|
| 25 |
"n_positions": 2048,
|
|
|
|
| 26 |
"num_experts_per_tok": 2,
|
|
|
|
|
|
|
| 27 |
"num_local_experts": 4,
|
|
|
|
| 28 |
"resid_pdrop": 0.1,
|
|
|
|
|
|
|
| 29 |
"rotary_dim": 32,
|
|
|
|
|
|
|
| 30 |
"tie_word_embeddings": false,
|
| 31 |
"torch_dtype": "float16",
|
| 32 |
+
"transformers_version": "4.35.2",
|
|
|
|
| 33 |
"vocab_size": 51200
|
| 34 |
+
}
|