henryhale/luganda-lima
Viewer • Updated • 685 • 93
How to use henryhale/Kintu-2.0-30M-Instruct with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="henryhale/Kintu-2.0-30M-Instruct")
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("henryhale/Kintu-2.0-30M-Instruct")
model = AutoModelForCausalLM.from_pretrained("henryhale/Kintu-2.0-30M-Instruct", 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]:]))How to use henryhale/Kintu-2.0-30M-Instruct with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "henryhale/Kintu-2.0-30M-Instruct"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "henryhale/Kintu-2.0-30M-Instruct",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/henryhale/Kintu-2.0-30M-Instruct
How to use henryhale/Kintu-2.0-30M-Instruct with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "henryhale/Kintu-2.0-30M-Instruct" \
--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": "henryhale/Kintu-2.0-30M-Instruct",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'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 "henryhale/Kintu-2.0-30M-Instruct" \
--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": "henryhale/Kintu-2.0-30M-Instruct",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use henryhale/Kintu-2.0-30M-Instruct with Docker Model Runner:
docker model run hf.co/henryhale/Kintu-2.0-30M-Instruct
A 30M-parameter Luganda chat model: Kintu-2.0-30M, further fine-tuned on multi-turn Luganda chats and then preference-tuned with DPO. The architecture and tokenizer are unchanged.
from transformers import AutoModelForCausalLM, AutoTokenizer
tok = AutoTokenizer.from_pretrained("henryhale/Kintu-2.0-30M-Instruct")
model = AutoModelForCausalLM.from_pretrained("henryhale/Kintu-2.0-30M-Instruct")
messages = [
{"role": "system", "content": "Oli muyambi ow'amagezi ayamba abantu mu Luganda."},
{"role": "user", "content": "Oli otya?"},
]
enc = tok.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt", return_dict=True)
out = model.generate(**enc, max_new_tokens=256, do_sample=True, temperature=0.4, top_p=0.8, repetition_penalty=1.2)
print(tok.decode(out[0, enc["input_ids"].shape[1]:], skip_special_tokens=True))
At 30M parameters it often drifts off-topic and gets facts wrong, so don't rely on it for information, especially on health, money or farming. The fine-tuning data is mostly AI-written and machine-translated, and hasn't been fully reviewed by native speakers. Keep chats short: it saw at most 512 tokens at a time.