Instructions to use microsoft/Phi-3-small-128k-instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use microsoft/Phi-3-small-128k-instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="microsoft/Phi-3-small-128k-instruct", 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("microsoft/Phi-3-small-128k-instruct", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use microsoft/Phi-3-small-128k-instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "microsoft/Phi-3-small-128k-instruct" # 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-small-128k-instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/microsoft/Phi-3-small-128k-instruct
- SGLang
How to use microsoft/Phi-3-small-128k-instruct 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-small-128k-instruct" \ --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-small-128k-instruct", "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-small-128k-instruct" \ --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-small-128k-instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use microsoft/Phi-3-small-128k-instruct with Docker Model Runner:
docker model run hf.co/microsoft/Phi-3-small-128k-instruct
Commit History
-
Update README.md (#42)
Verified signature- Update README.md (ad47acf9640951202a7533f3c90bc2a261879b91) Co-authored-by: Blake S <bsnelling@users.noreply.huggingface.co>e95b185 -
Upload data_summary_card.md (#41)
Verified signature- Upload data_summary_card.md (c7fcd9605578986bc44c8f55b7cc270a5de2c49d) Co-authored-by: Blake S <bsnelling@users.noreply.huggingface.co>87b332e
-
Move flash_attn assert from __init__ into calling func (#32)
Verified signature- Change the assert to warning in __init__ (e4f4e18f099e6fd012bfed0bd3170dc2ea209592) - Update modeling_phi3_small.py (e203eff1c173b6ff6f356c6a9e9e9fb9f2371c72) - Update modeling_phi3_small.py (bef256d02055a0870d55b9d21fc35d68bdee1c61) - Moved flash_attn assert close to the caller (e4770004838da0fec2d9f8cdb60f8417e5394ba7) Co-authored-by: Roger Feng <rogerxfeng8@users.noreply.huggingface.co>ad85cab
-
Update README.md
Verified signature97bc412
-
Update tokenization_phi3_small.py (#14)
Verified signature- Update tokenization_phi3_small.py (ba1093228468c670d80108f9fa92c09d39e08854) Co-authored-by: David Majercak <damajercakms@users.noreply.huggingface.co>f80aaa3
-
Add link to Phi-3 vision ONNX models
Verified signature45ff32d
-
Update README.md
Verified signature985e27b
-
Add attention_bias to make TGI work (#4)
Verified signature- Add attention_bias to make TGI work (9c9f6d150c9c19b659f2f452e92c64687ce8c249) - Update config.json (b62ee4629858d8d25483d626ee5753baf6e05547) Co-authored-by: Philipp Schmid <philschmid@users.noreply.huggingface.co>5e0fbf0
-
Update README
Verified signature2fe15b2
-
chore(root): Initial files upload.
- Upload 3 files (c05f92cea7fa1c65c930948bd60e1b6ba8803134) Co-authored-by: Barun <bapatra@users.noreply.huggingface.co>bb05330
-
Initial commit
Unverified signature7a8ccc0