Instructions to use ai-for-good-lab/byol-nya-4b-it with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ai-for-good-lab/byol-nya-4b-it with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ai-for-good-lab/byol-nya-4b-it") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("ai-for-good-lab/byol-nya-4b-it") model = AutoModelForMultimodalLM.from_pretrained("ai-for-good-lab/byol-nya-4b-it", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.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=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use ai-for-good-lab/byol-nya-4b-it with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ai-for-good-lab/byol-nya-4b-it" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ai-for-good-lab/byol-nya-4b-it", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/ai-for-good-lab/byol-nya-4b-it
- SGLang
How to use ai-for-good-lab/byol-nya-4b-it 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 "ai-for-good-lab/byol-nya-4b-it" \ --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": "ai-for-good-lab/byol-nya-4b-it", "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 "ai-for-good-lab/byol-nya-4b-it" \ --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": "ai-for-good-lab/byol-nya-4b-it", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use ai-for-good-lab/byol-nya-4b-it with Docker Model Runner:
docker model run hf.co/ai-for-good-lab/byol-nya-4b-it
BYOL Chichewa 4B IT
This model was produced by the BYOL framework for extending LLMs to low-resource languages.
- Base model: google/gemma-3-4b-pt
- Language: Chichewa (nya)
- Training stage: Instruction Tuning (SFT)
- License: Gemma Terms of Use (derived from Gemma 3)
- Paper: BYOL: Bring Your Own Language Into LLMs
- Code: github.com/microsoft/byol
Model Description
This is an instruction-tuned (SFT) language model for Chichewa (nya). It was created by applying supervised fine-tuning on top of the BYOL Chichewa 4b CPT checkpoint, using translated instruction-following data (SmolTalk2 + AYA) generated via the BYOL framework.
This is an intermediate checkpoint used to produce the merged model. For best results, use the merged variant instead, which combines the language knowledge from CPT with the instruction-following ability from this model.
Usage
pip install -U transformers
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model_id = "ai-for-good-lab/byol-nya-4b-it"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto", dtype=torch.bfloat16)
# Chat inference
messages = [{"role": "user", "content": "Tandiuzeni za dziko la Malawi."}]
inputs = tokenizer.apply_chat_template(messages, return_tensors="pt", add_generation_prompt=True, return_dict=True).to(model.device)
outputs = model.generate(**inputs, max_new_tokens=256)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
Citation
@article{zamir2026byolbringlanguagellms,
title={BYOL: Bring Your Own Language Into LLMs},
author={Syed Waqas Zamir and Wassim Hamidouche and Boulbaba Ben Amor and Luana Marotti and Inbal Becker-Reshef and Juan Lavista Ferres},
year={2026},
journal={arXiv:2601.10804},
url={https://arxiv.org/abs/2601.10804},
}
- Downloads last month
- 7
Model tree for ai-for-good-lab/byol-nya-4b-it
Base model
google/gemma-3-4b-pt