Text Generation
Transformers
Safetensors
multilingual
phi3_v
nlp
code
vision
conversational
custom_code
Instructions to use microsoft/Phi-3-vision-128k-instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use microsoft/Phi-3-vision-128k-instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="microsoft/Phi-3-vision-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-vision-128k-instruct", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use microsoft/Phi-3-vision-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-vision-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-vision-128k-instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/microsoft/Phi-3-vision-128k-instruct
- SGLang
How to use microsoft/Phi-3-vision-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-vision-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-vision-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-vision-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-vision-128k-instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use microsoft/Phi-3-vision-128k-instruct with Docker Model Runner:
docker model run hf.co/microsoft/Phi-3-vision-128k-instruct
Commit History
-
Update README.md (#73)
Verified signature- Update README.md (619ad685d1b3c8042edfcf8eb77cdf2e97128af2) Co-authored-by: Blake S <bsnelling@users.noreply.huggingface.co>ed2772f -
Upload data_summary_card.md (#72)
Verified signature- Upload data_summary_card.md (5cc02834d2a4808f4868ada1c096a3a1d71eda9a) Co-authored-by: Blake S <bsnelling@users.noreply.huggingface.co>7c760c5
-
Update README.md
Verified signaturec45209e -
Update README.md
Verified signature5bc05f2
-
Fix generation when `repetition_penalty` is activated (#57)
Verified signature- make sure input_ids do not contain negative numbers (indicating images) after they are no longer needed (5905c926df4db18660da263a9777998ca66a14fe) Co-authored-by: Yen-Chun Chen <YenChunChen@users.noreply.huggingface.co>6065b7a
-
Fix number of image tokens (#51)
Verified signature- Fix number of image tokens (4eedefefd840f457373d13c6043ef9aed8153c78) Co-authored-by: Moshe Berchansky <mber@users.noreply.huggingface.co>b161793
-
Rewrite image embedding to remove the in-place op (#53)
Verified signature- remove the in-place op (b185b062202fd6fc9d48b5c53fc95b320341a1d9) Co-authored-by: Yen-Chun Chen <YenChunChen@users.noreply.huggingface.co>866d169 -
Use Flash Attention for CLIP image encoder (#52)
Verified signature- add flash attention support for CLIP (5d83217d777dcbf324206dba8b723231761f8a29) Co-authored-by: Yen-Chun Chen <YenChunChen@users.noreply.huggingface.co>1a87b10
-
Update README.md
Verified signaturef998a18
-
clean_sample_code (#36)
Verified signature- remove useless sample code (5bbaa42f12e926c3ce90d4ce4113e4566d8c16b5) Co-authored-by: Haiping Wu <haipingwu@users.noreply.huggingface.co>7b92b8c
-
Make flash attention configurable in user code (#26)
Verified signature- make flash attention usage configurable from user code (bfc0c05f87cedd15a3877b0ef4761371a66f2bb5) - update readme regarding FA2 (ff0d44e7ba0a5d4c0ec5d4c71d2f980188dd78f1) - change example code's default to FA2 (71625d6443f2af02ec0a1d6581398cca783b5fa9) - config defaults to FA2, code snippet in README shows explicit argument in `from_pretrained` (39787965998214db71951e73aab0eb05d6dfe4a5) Co-authored-by: Yen-Chun Chen <YenChunChen@users.noreply.huggingface.co>fea3f11 -
Add link to Phi-3 vision ONNX models
Verified signature11cb03c
-
correct the paper reference (#25)
Verified signature- correct the paper reference (60b3121394096f619f99dff95866a4bc4bd47e4c) Co-authored-by: Yixiang Gao <g1y5x3@users.noreply.huggingface.co>5dcfdfb
-
Update README.md (#14)
Verified signature- Update README.md (d016b7fa4e018c2b1aa48963afaaeda01a3b9b4f) Co-authored-by: Krzysztof Pawelec <Criztov@users.noreply.huggingface.co>dbcdaaa
-
Update README
Verified signature2b07137 -
Update README
Verified signature94f6e2f -
Update README
Verified signature034a3df -
Update README
Verified signatured33b637 -
Update README
Verified signature4ed3dc0
-
chore(root): Initial files upload.
44c7c8b
-
initial commit
Verified signature7ba0150