Instructions to use microsoft/phi-1_5 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use microsoft/phi-1_5 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="microsoft/phi-1_5")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("microsoft/phi-1_5") model = AutoModelForCausalLM.from_pretrained("microsoft/phi-1_5", device_map="auto") - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use microsoft/phi-1_5 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "microsoft/phi-1_5" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "microsoft/phi-1_5", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/microsoft/phi-1_5
- SGLang
How to use microsoft/phi-1_5 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-1_5" \ --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": "microsoft/phi-1_5", "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 "microsoft/phi-1_5" \ --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": "microsoft/phi-1_5", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use microsoft/phi-1_5 with Docker Model Runner:
docker model run hf.co/microsoft/phi-1_5
Commit History
-
Update README.md (#94)
Verified signature- Update README.md (c8adf60ddb963216c1fcf50dc2d260e82066b8f3) Co-authored-by: Blake S <bsnelling@users.noreply.huggingface.co>77aa61e -
Upload data_summary_card.md (#93)
Verified signature- Upload data_summary_card.md (1ec77b2b01ea222e838a3be93090f6fd166827c0) Co-authored-by: Blake S <bsnelling@users.noreply.huggingface.co>fa4c2fb
-
fix(config): Removes auto_map since it is not used anymore.
Verified signature675aa38
-
Delete modeling_phi.py
Verified signaturedb56137 -
Delete configuration_phi.py
Verified signaturede9f725 -
Update README.md
Verified signature467adac
-
Delete pytorch_model.bin
Verified signature474b29e -
Adding `safetensors` variant of this model (#82)
Verified signature- Adding `safetensors` variant of this model (7e19e91fd0b2aaa2ec50981d2459604b2af7ac89) Co-authored-by: Safetensors convertbot <SFconvertbot@users.noreply.huggingface.co>fa2a356
-
Update LICENSE
Verified signaturebffd3b2
-
Update README.md
Verified signature349cf8b
-
Update README.md
Verified signature83b9c52 -
Update config.json
Verified signature675e8c1
-
Update modeling_phi.py
Verified signature34a1490 -
Update README.md
Verified signature59e722d
-
Update modeling_phi.py
Verified signature426ea90
-
Update modeling_phi.py
Verified signature3edb5e6
-
Update modeling_phi.py
Verified signaturee0f03c4 -
Update config.json
Verified signature051d15f
-
Upload modeling_phi.py
914c8fb -
Delete Research License.docx
3a705a2 -
Upload 5 files
341a17a -
Update README.md (#69)
- Update README.md (8584061b4d9f189aea26e170cb1c285a22fe731d) Co-authored-by: Mojan Javaheripi <mojanjp@users.noreply.huggingface.co>1dc35eb
-
Update config.json
41217aa -
chore(root): Updates files to internal transformers implementation.
d3ba318
-
Update README.md
24f9ea1 -
Upload 4 files
d262514 -
Update README.md
f27cd93 -
Update README.md
80c0ba9 -
Disables inference API to prevent mismatch with HF implementation.
a286f5c
-
fix(modeling_phi): Fixes initial generation with length larger than context length.
ca573e3
-
fix(modeling_phi): Fixes cached generation when above maximum context length.
37527ba
-
Fixes exceeding maximum sequence length when using generate().
5fd430c
-
Delete modeling_mixformer_sequential.py
d212a78 -
Delete configuration_mixformer_sequential.py
8e9ebfb -
Update to new model interface.
271c339
-
Improves type hinting on configuration arguments.
92557d0 -
Enables to toggle fused_dense, flash_rotary and attn_pdrop in the configuration.
45f4b21 -
Fixes flash-attn import with a try/except statement
0254d42 -
Adds support for flash-attn rotary embedding and fused dense layers.
0bbd68a
-
Adds support for MQA/GQA and attention mask during training.
de35f90
-
Update modeling_mixformer_sequential.py
Removes print regarding attention_mask to prevent excessive information from being logged.d38e6f9
-
Adding _set_gradient_checkpointing for compatibility (#22)
- Adding _set_gradient_checkpointing for compatibility (a30a931294ac0f344a0c1547877c692ceb17123c) Co-authored-by: Vicente Rivera <vriveras@users.noreply.huggingface.co>8091327
-
Upload modeling_mixformer_sequential.py
b6a7e2f -
Add more precise license metadata (UI will be cleaner!) (#35)
- Add more precise license metadata (UI will be cleaner!) (2c182742af8c7c93f0f4ee1180232a5d0c114958) Co-authored-by: Julien Chaumond <julien-c@users.noreply.huggingface.co>8ab0f29 -
Upload README.md
bc09a08
-
fix(phi-1_5): Checks length of `attention_mask`if it is passed as direct tensor.
f9f2ac7 -
Support for `attention_mask` in forward pass.
This commit implements the following: - Cleans up unused arguments and definitions. - Adds support for `attention_mask`. - Adds support for cached inference.3128bb6
-
add _no_split_modules property (#17)
- add _no_split_modules property (7e925ddfdf2d1bb29fc26db755aafd77fb8f565e) Co-authored-by: wing lian <winglian@users.noreply.huggingface.co>4a426d8
-
Update README.md
7d482dd
-
Update README.md
c8f6ad8