Instructions to use microsoft/Phi-3-mini-4k-instruct-onnx with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use microsoft/Phi-3-mini-4k-instruct-onnx with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="microsoft/Phi-3-mini-4k-instruct-onnx", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("microsoft/Phi-3-mini-4k-instruct-onnx", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use microsoft/Phi-3-mini-4k-instruct-onnx with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "microsoft/Phi-3-mini-4k-instruct-onnx" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "microsoft/Phi-3-mini-4k-instruct-onnx", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/microsoft/Phi-3-mini-4k-instruct-onnx
- SGLang
How to use microsoft/Phi-3-mini-4k-instruct-onnx 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 "microsoft/Phi-3-mini-4k-instruct-onnx" \ --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": "microsoft/Phi-3-mini-4k-instruct-onnx", "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 "microsoft/Phi-3-mini-4k-instruct-onnx" \ --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": "microsoft/Phi-3-mini-4k-instruct-onnx", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use microsoft/Phi-3-mini-4k-instruct-onnx with Docker Model Runner:
docker model run hf.co/microsoft/Phi-3-mini-4k-instruct-onnx
fix(genai_config): Adds extra EOS token to improve chat outputs.
Browse files
cpu_and_mobile/cpu-int4-rtn-block-32-acc-level-4/genai_config.json
CHANGED
|
@@ -28,6 +28,7 @@
|
|
| 28 |
},
|
| 29 |
"eos_token_id": [
|
| 30 |
32000,
|
|
|
|
| 31 |
32007
|
| 32 |
],
|
| 33 |
"pad_token_id": 32000,
|
|
|
|
| 28 |
},
|
| 29 |
"eos_token_id": [
|
| 30 |
32000,
|
| 31 |
+
32001,
|
| 32 |
32007
|
| 33 |
],
|
| 34 |
"pad_token_id": 32000,
|
cpu_and_mobile/cpu-int4-rtn-block-32/genai_config.json
CHANGED
|
@@ -28,6 +28,7 @@
|
|
| 28 |
},
|
| 29 |
"eos_token_id": [
|
| 30 |
32000,
|
|
|
|
| 31 |
32007
|
| 32 |
],
|
| 33 |
"pad_token_id": 32000,
|
|
|
|
| 28 |
},
|
| 29 |
"eos_token_id": [
|
| 30 |
32000,
|
| 31 |
+
32001,
|
| 32 |
32007
|
| 33 |
],
|
| 34 |
"pad_token_id": 32000,
|
cuda/cuda-fp16/genai_config.json
CHANGED
|
@@ -33,6 +33,7 @@
|
|
| 33 |
},
|
| 34 |
"eos_token_id": [
|
| 35 |
32000,
|
|
|
|
| 36 |
32007
|
| 37 |
],
|
| 38 |
"pad_token_id": 32000,
|
|
|
|
| 33 |
},
|
| 34 |
"eos_token_id": [
|
| 35 |
32000,
|
| 36 |
+
32001,
|
| 37 |
32007
|
| 38 |
],
|
| 39 |
"pad_token_id": 32000,
|
cuda/cuda-int4-rtn-block-32/genai_config.json
CHANGED
|
@@ -33,6 +33,7 @@
|
|
| 33 |
},
|
| 34 |
"eos_token_id": [
|
| 35 |
32000,
|
|
|
|
| 36 |
32007
|
| 37 |
],
|
| 38 |
"pad_token_id": 32000,
|
|
|
|
| 33 |
},
|
| 34 |
"eos_token_id": [
|
| 35 |
32000,
|
| 36 |
+
32001,
|
| 37 |
32007
|
| 38 |
],
|
| 39 |
"pad_token_id": 32000,
|
directml/directml-int4-awq-block-128/genai_config.json
CHANGED
|
@@ -31,6 +31,7 @@
|
|
| 31 |
},
|
| 32 |
"eos_token_id": [
|
| 33 |
32000,
|
|
|
|
| 34 |
32007
|
| 35 |
],
|
| 36 |
"pad_token_id": 32000,
|
|
|
|
| 31 |
},
|
| 32 |
"eos_token_id": [
|
| 33 |
32000,
|
| 34 |
+
32001,
|
| 35 |
32007
|
| 36 |
],
|
| 37 |
"pad_token_id": 32000,
|