Instructions to use Lexsi/tiny-aya-global-hh-rlhf-aligned with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Lexsi/tiny-aya-global-hh-rlhf-aligned with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Lexsi/tiny-aya-global-hh-rlhf-aligned") 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("Lexsi/tiny-aya-global-hh-rlhf-aligned") model = AutoModelForCausalLM.from_pretrained("Lexsi/tiny-aya-global-hh-rlhf-aligned", 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]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Lexsi/tiny-aya-global-hh-rlhf-aligned with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Lexsi/tiny-aya-global-hh-rlhf-aligned" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Lexsi/tiny-aya-global-hh-rlhf-aligned", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Lexsi/tiny-aya-global-hh-rlhf-aligned
- SGLang
How to use Lexsi/tiny-aya-global-hh-rlhf-aligned 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 "Lexsi/tiny-aya-global-hh-rlhf-aligned" \ --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": "Lexsi/tiny-aya-global-hh-rlhf-aligned", "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 "Lexsi/tiny-aya-global-hh-rlhf-aligned" \ --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": "Lexsi/tiny-aya-global-hh-rlhf-aligned", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Lexsi/tiny-aya-global-hh-rlhf-aligned with Docker Model Runner:
docker model run hf.co/Lexsi/tiny-aya-global-hh-rlhf-aligned
Tiny-Aya-Global: HH-RLHF Safety Alignment
CohereLabs/tiny-aya-globalsafety-aligned with DPO on Anthropic HH-RLHF (harmless-base), using the SafeTune paper's parameters.
What we did
We aligned CohereLabs/tiny-aya-global for safety with Direct Preference Optimization (LoRA, merged into the base weights) on the
harmless-base split of Anthropic/hh-rlhf. You get one drop-in
checkpoint: the LoRA adapter is already merged, so it is loaded and served exactly like the base model.
Built using SafeTune, Lexsi's library for auditing and correcting safety drift.
| Training parameter | Value |
|---|---|
| Method | DPO + LoRA (TRL 0.23.0), adapter merged into bf16 base |
| Dataset | Anthropic/hh-rlhf, harmless-base, train, 20,000 samples |
| β | 0.1 |
| Learning rate | 2e-5 (cosine, warmup ratio 0.03) |
| Epochs | 1 (1,249 steps) |
| Batch size | 2 per device × 8 gradient accumulation |
| LoRA | r = 16, α = 32, dropout 0.05; q, k, v, o, gate, up, down projections |
| Max length | 1,024 tokens (prompt 512) |
| Precision | bf16 |
| Base model | CohereLabs/tiny-aya-global |
| Developed by | Lexsi Labs (Lithasa Technologies Pvt. Ltd.) |
| Model size | 3.35B parameters |
| Context length | 8K tokens (inherited from the base model) |
| Languages | 70+ (inherited from the base model) |
| License | CC-BY-NC 4.0 (inherited from the base model); see License |
| Contact | support@lexsi.ai |
Usage
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "Lexsi/tiny-aya-global-hh-rlhf-aligned"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, dtype=torch.bfloat16, device_map="auto")
messages = [{"role": "user", "content": "How can I stay safe when meeting someone from an online forum?"}]
inputs = tokenizer.apply_chat_template(
messages, add_generation_prompt=True, return_tensors="pt", return_dict=True
).to(model.device)
out = model.generate(**inputs, max_new_tokens=512, do_sample=False)
print(tokenizer.decode(out[0][inputs["input_ids"].shape[-1]:], skip_special_tokens=True))
License
This is a derivative work of CohereLabs/tiny-aya-global, which Cohere Labs releases under
CC-BY-NC 4.0 with its Acceptable Use Policy. This checkpoint
inherits those terms: non-commercial use with attribution. Please also follow the
Cohere Labs Acceptable Use Policy.
Contact
Questions or errors in this card: support@lexsi.ai
- Downloads last month
- 5