Instructions to use 01-ai/Yi-1.5-9B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use 01-ai/Yi-1.5-9B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="01-ai/Yi-1.5-9B")# Load model directly from transformers import AutoTokenizer, AutoModelForMultimodalLM tokenizer = AutoTokenizer.from_pretrained("01-ai/Yi-1.5-9B") model = AutoModelForMultimodalLM.from_pretrained("01-ai/Yi-1.5-9B") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use 01-ai/Yi-1.5-9B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "01-ai/Yi-1.5-9B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "01-ai/Yi-1.5-9B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/01-ai/Yi-1.5-9B
- SGLang
How to use 01-ai/Yi-1.5-9B 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 "01-ai/Yi-1.5-9B" \ --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": "01-ai/Yi-1.5-9B", "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 "01-ai/Yi-1.5-9B" \ --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": "01-ai/Yi-1.5-9B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use 01-ai/Yi-1.5-9B with Docker Model Runner:
docker model run hf.co/01-ai/Yi-1.5-9B
| 7fce5d6efd064e026076475ddf9bf7b3 model-00001-of-00004.safetensors | |
| 4c0f28fae242de999994b86f1048cd5b model-00002-of-00004.safetensors | |
| a9e2aeffc80bd2e10e4be1de4c7ef471 model-00003-of-00004.safetensors | |
| 162f9088a941601d2731a6f18cd2ee95 model-00004-of-00004.safetensors | |
| 8918290652a4ee6dc89dea20d86768d4 model.safetensors.index.json | |
| 9eaf4a967754057f6abf81ce9e3c2952 tokenizer_config.json | |
| 86e190b9782f5ca378a0eb25f30a0f69 tokenizer.json | |
| 291724ef50f729e45d68f474a7755bbc tokenizer.model | |