Instructions to use timidan/oya-tiny-aya-sft-v2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use timidan/oya-tiny-aya-sft-v2 with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("CohereLabs/tiny-aya-global") model = PeftModel.from_pretrained(base_model, "timidan/oya-tiny-aya-sft-v2") - Transformers
How to use timidan/oya-tiny-aya-sft-v2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="timidan/oya-tiny-aya-sft-v2") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("timidan/oya-tiny-aya-sft-v2", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use timidan/oya-tiny-aya-sft-v2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "timidan/oya-tiny-aya-sft-v2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "timidan/oya-tiny-aya-sft-v2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/timidan/oya-tiny-aya-sft-v2
- SGLang
How to use timidan/oya-tiny-aya-sft-v2 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 "timidan/oya-tiny-aya-sft-v2" \ --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": "timidan/oya-tiny-aya-sft-v2", "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 "timidan/oya-tiny-aya-sft-v2" \ --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": "timidan/oya-tiny-aya-sft-v2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use timidan/oya-tiny-aya-sft-v2 with Docker Model Runner:
docker model run hf.co/timidan/oya-tiny-aya-sft-v2
Oya: Tiny Aya wallet agent (LoRA, v2)
A LoRA adapter that turns Cohere Labs' Tiny Aya Global (3.35B) into a tool-calling wallet agent for English, Nigerian Pidgin, Yoruba and Yoruba-English mix. It buys airtime and data, pays for electricity and sends money through seven tools; it asks when details are missing, refuses to overspend, and ignores instructions planted in tool results. Made for the Lexsi Labs AI Safety & Alignment Hackathon (Track 3) with Lexsi Labs' AgentTune and AuditKIT.
Try it in the demo Space. For a laptop CPU, use the GGUF.
Results
Scored against a mock wallet: what happened to the money, not what the model said it did.
| Untrained Tiny Aya | Oya v2 | |
|---|---|---|
| Task success, 416 development tasks | 39.2% | 97.4% |
| Safety tasks handled correctly | 18.8% | 100% |
| Tasks where money moved that should not have | 18.3% | 2.4% |
| Task success, 30 held-out requests typed by a native speaker | 23.3% | 100% |
| Same 30, with the reply in the right language and asking for the right detail | 20.0% | 83.3% |
Method, comparisons with other models and caveats are in the write-up.
Use
The adapter was trained with the repo's compact system prompt and tool format:
# git clone https://github.com/Timidan/lexsi-hack && cd lexsi-hack
import os
os.environ["OYA_PROMPT"] = "compact"
from naija_agent.hf_policy import HFPolicy
from naija_agent.prompting import system_message
oya = HFPolicy("CohereLabs/tiny-aya-global", adapter="timidan/oya-tiny-aya-sft-v2")
chat = [{"role": "system", "content": system_message()},
{"role": "user", "content": "Abeg buy ₦500 MTN airtime for 08031234567."}]
print(oya([chat])[0]) # a JSON list of tool calls; naija_agent/runner.py runs them and continues the chat
Training
- 2,080 reference chats (13 task categories × 4 languages × 40), loss on assistant turns only: the
sftconfig of timidan/oya-wallet-agent-data. - LoRA rank 16, alpha 32; 1 epoch; learning rate 2e-4; 75 minutes on two Kaggle T4s.
train_log.jsonandloss.pngare in this repo.
Licence
CC-BY-NC 4.0, following Tiny Aya; Cohere Labs' Acceptable Use Policy applies.
- Downloads last month
- 34