Instructions to use ByteDance/Ouro-1.4B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ByteDance/Ouro-1.4B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ByteDance/Ouro-1.4B", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("ByteDance/Ouro-1.4B", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use ByteDance/Ouro-1.4B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ByteDance/Ouro-1.4B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ByteDance/Ouro-1.4B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/ByteDance/Ouro-1.4B
- SGLang
How to use ByteDance/Ouro-1.4B 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 "ByteDance/Ouro-1.4B" \ --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": "ByteDance/Ouro-1.4B", "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 "ByteDance/Ouro-1.4B" \ --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": "ByteDance/Ouro-1.4B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use ByteDance/Ouro-1.4B with Docker Model Runner:
docker model run hf.co/ByteDance/Ouro-1.4B
Fix for KV Cache Bug - ouro-cache-fix Package
# Solution for KV Cache Bug in Ouro-1.4B
I've created a Python package that fixes the KV cache indexing bug affecting inference speed.
## π¦ Package: ouro-cache-fix
- PyPI: https://pypi.org/project/ouro-cache-fix/
- GitHub: https://github.com/Antizana/ouro-cache-fix
## β¨ What it fixes
- Resolves cache out-of-bounds errors during generation
- Improves inference speed by 1.3-1.7x
- Drop-in replacement for DynamicCache
## π Usage
```python
from transformers import AutoModelForCausalLM
from ouro_cache_fix import UniversalTransformerCache
model = AutoModelForCausalLM.from_pretrained(
"ByteDance/Ouro-1.4B",
trust_remote_code=True,
cache_implementation=UniversalTransformerCache
)
Tested with transformers 4.36.0+ and torch 2.0.0+.
Would appreciate feedback and testing!
Thank you for this valuable contribution! We've verified that your fix successfully enables Ouro to run with transformers>=4.56.0. We've now merged your KV cache optimization into our model repository and credited your work in the model card's Acknowledgments section. We really appreciate your effort in improving the model's compatibility!
After your last update, I get
AttributeError: property 'key_cache' of 'UniversalTransformerCache' object has no setter
even when running the example code from the model card
After your last update, I get
AttributeError: property 'key_cache' of 'UniversalTransformerCache' object has no setter
even when running the example code from the model card
ByteDance has already included this fix as native functionality in the model, as mentioned in the previous comment.