Text Generation
Transformers
Safetensors
multilingual
llama
unsloth
phi3
phi
microsoft
conversational
text-generation-inference
Instructions to use unsloth/Phi-3.5-mini-instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use unsloth/Phi-3.5-mini-instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="unsloth/Phi-3.5-mini-instruct") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("unsloth/Phi-3.5-mini-instruct") model = AutoModelForCausalLM.from_pretrained("unsloth/Phi-3.5-mini-instruct", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use unsloth/Phi-3.5-mini-instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "unsloth/Phi-3.5-mini-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": "unsloth/Phi-3.5-mini-instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/unsloth/Phi-3.5-mini-instruct
- SGLang
How to use unsloth/Phi-3.5-mini-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 "unsloth/Phi-3.5-mini-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": "unsloth/Phi-3.5-mini-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 "unsloth/Phi-3.5-mini-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": "unsloth/Phi-3.5-mini-instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Desktop
- Docker Model Runner
How to use unsloth/Phi-3.5-mini-instruct with Docker Model Runner:
docker model run hf.co/unsloth/Phi-3.5-mini-instruct
Commit History
-
Remove the incorrect LongRoPE attention_factor
Verified signatureattention_factor was set to 32.0, which is the context extension factor, not the attention scaling factor. The correct value is sqrt(1 + ln(32)/ln(4096)) = 1.1902, so attention was being scaled about 27 times too high and the model sat near the entropy of a uniform distribution over its own vocabulary. Deleting the key rather than hardcoding 1.1902 lets transformers derive it from factor, matching microsoft/Phi-3.5-mini-instruct, which does not carry the key at all. Measured, plain transformers bf16, teacher-forced cross-entropy on a fixed passage, no training: microsoft/Phi-3.5-mini-instruct 1.8885 this repo before 6.3210 this repo after 1.8885e2a5ff0
-
Update README.md
Verified signaturea6499ca -
Update README.md
Verified signature63db8e7
-
Update README.md
Verified signatureae50d82 -
Update README.md
Verified signature7244cc4 -
Update config.json
Verified signaturef4d7f07 -
Update config.json
Verified signature05dff32 -
Update config.json
Verified signatureb577032 -
Update config.json
Verified signature2d24617 -
Upload tokenizer
Verified signature58a28fc -
Upload LlamaForCausalLM
Verified signaturea7e4d70 -
initial commit
Verified signature6f655bc