Instructions to use microsoft/kosmos-2.5-chat with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use microsoft/kosmos-2.5-chat with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="microsoft/kosmos-2.5-chat")# pip install -U transformers accelerate # Load model directly from transformers import AutoImageProcessor, AutoModelForMultimodalLM processor = AutoImageProcessor.from_pretrained("microsoft/kosmos-2.5-chat") model = AutoModelForMultimodalLM.from_pretrained("microsoft/kosmos-2.5-chat", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use microsoft/kosmos-2.5-chat with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "microsoft/kosmos-2.5-chat" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "microsoft/kosmos-2.5-chat", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/microsoft/kosmos-2.5-chat
- SGLang
How to use microsoft/kosmos-2.5-chat 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/kosmos-2.5-chat" \ --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/kosmos-2.5-chat", "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/kosmos-2.5-chat" \ --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/kosmos-2.5-chat", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use microsoft/kosmos-2.5-chat with Docker Model Runner:
docker model run hf.co/microsoft/kosmos-2.5-chat
Commit History
-
Add code snippets, metadata tags (#3)
Verified signature- Add code snippets, metadata tags (2428a783737ceece641c973c90ccbcfcdd1c822a) - Update README.md (609c6f20d6f10b2f7f7f8e967b3d4e13047ae748) Co-authored-by: Niels Rogge <nielsr@users.noreply.huggingface.co>edf7d31
-
update after integration (#2)
Verified signature- update after integration (685ba6739fbbf5bc2a11d1891774bce47b18f681) - update after integration (245a0c80f5fae5d59206b911b968dc842fb68d12) - update after integration (076bc11236d9b61242c1012fdc862fa53eb20080) - update after integration (9828c5ff31e58da0074045a457fa0d026694aff9)c9b2f7b
-
Update README.md
Verified signatured4d5978 -
checkpoint (#1)
Verified signature- add ckpt (db6195b6ff952dcc7f4faaf832b21f9a34c37f77) - 828_1305 (4bd36dd0090605b388a4476def299360e03cac19) Co-authored-by: zhaoyuzhong <callsys@users.noreply.huggingface.co>3a797b1
-
initial commit
Verified signature565c482