Instructions to use CohereLabs/tiny-aya-global with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use CohereLabs/tiny-aya-global with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="CohereLabs/tiny-aya-global") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("CohereLabs/tiny-aya-global") model = AutoModelForCausalLM.from_pretrained("CohereLabs/tiny-aya-global", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Inference
- HuggingChat
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use CohereLabs/tiny-aya-global with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "CohereLabs/tiny-aya-global" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "CohereLabs/tiny-aya-global", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/CohereLabs/tiny-aya-global
- SGLang
How to use CohereLabs/tiny-aya-global 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 "CohereLabs/tiny-aya-global" \ --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": "CohereLabs/tiny-aya-global", "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 "CohereLabs/tiny-aya-global" \ --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": "CohereLabs/tiny-aya-global", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use CohereLabs/tiny-aya-global with Docker Model Runner:
docker model run hf.co/CohereLabs/tiny-aya-global
generation_config.json stops on <EOS_TOKEN> (id 3), but chat turns end with <|END_OF_TURN_TOKEN|> (id 6)
Hi, thanks for releasing Tiny Aya. I found a small mismatch in the stop token settings that wastes generation time.
What I see
generation_config.json and config.json set eos_token_id to 3 (<EOS_TOKEN>), but the tokenizer's EOS token is <|END_OF_TURN_TOKEN|> (id 6), which is what ends an assistant turn in the chat template.
from transformers import AutoTokenizer, GenerationConfig
m = "CohereLabs/tiny-aya-global"
print(GenerationConfig.from_pretrained(m).eos_token_id) # 3
print(AutoTokenizer.from_pretrained(m).eos_token_id) # 6
Checked on revision af89d219.
Effect
With model.generate(...) and the default generation config, generation only stops on token 3. In my runs with greedy decoding, the model finished its answer with token 6 and then kept emitting token 6 until max_new_tokens. The extra tokens are special tokens, so they disappear when decoding with skip_special_tokens=True and the text looks normal. The cost is hidden: every answer uses the full token budget, and a library that only returns decoded text cannot tell that the answer finished early.
After passing both ids as stop tokens, one batch of four answers went from about 30 s to about 7 s on my machine (768 new tokens allowed).
Workaround
model.generate(**inputs, eos_token_id=[3, 6], ...)
Suggested fix
Set "eos_token_id": [3, 6] in generation_config.json, so chat generation stops at the end of the turn by default. It may be worth checking the other Tiny Aya variants for the same setting.