CoolFace
Modelpublic

dsfsi/tiny_aya_global-lora-r64-nso-eng

sourceHugging Faceapache-2.0updated 4mo agoView on Hugging Face
0likes11downloads
Model Card

tinyayaglobal-lora-r64-nso-eng

![Model on HF](https://huggingface.co/dsfsi/tinyayaglobal-lora-r64-nso-eng)

This is a LoRA adapter for the AfriScience-MT project, enabling efficient scientific machine translation for African languages.

Adapter Description

PropertyValue
Base ModelCohereLabs/tiny-aya-global
Translation DirectionNorthern Sotho → English
LoRA Rank (r)64
LoRA Alpha128
Training MethodQLoRA (4-bit quantization)
DomainScientific/Academic texts

Why LoRA?

LoRA (Low-Rank Adaptation) enables efficient fine-tuning by training only a small number of additional parameters. This adapter adds only ~32.0M parameters to the base model while achieving strong translation performance.

Evaluation Results

Performance on the AfriScience-MT test set:

SplitBLEUchrFSSA-COMET
Test24.3753.13None

Metrics explanation:

  • —BLEU: Measures n-gram overlap with reference translations (0-100, higher is better)
  • —chrF: Character-level F-score, robust for morphologically rich languages (0-100, higher is better)
  • —SSA-COMET: Neural metric trained for Sub-Saharan African languages, shown as percentage (0-100, higher is better) (McGill-NLP/ssa-comet-stl)

Usage

Quick Start

python
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
from peft import PeftModel
import torch

# Configure 4-bit quantization (recommended for memory efficiency)
bnb_config = BitsAndBytesConfig(
    load_in_4bit=True,
    bnb_4bit_compute_dtype=torch.bfloat16,
    bnb_4bit_quant_type="nf4",
    bnb_4bit_use_double_quant=True,
)

# Load base model
base_model = AutoModelForCausalLM.from_pretrained(
    "CohereLabs/tiny-aya-global",
    quantization_config=bnb_config,
    device_map="auto",
    torch_dtype=torch.bfloat16,
)
tokenizer = AutoTokenizer.from_pretrained("CohereLabs/tiny-aya-global")

# Load LoRA adapter
adapter_name = "dsfsi/tiny_aya_global-lora-r64-nso-eng"
model = PeftModel.from_pretrained(base_model, adapter_name)
model.eval()

# Prepare translation prompt
source_text = "Climate change significantly impacts agricultural productivity in sub-Saharan Africa."
instruction = "Translate the following Northern Sotho scientific text to English."

# Format prompt
prompt = f"""### Instruction:
{instruction}

### Input:
{source_text}

### Response:
"""

# Generate translation
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
with torch.no_grad():
    outputs = model.generate(
        **inputs,
        max_new_tokens=256,
        num_beams=5,
        early_stopping=True,
        pad_token_id=tokenizer.pad_token_id,
    )

# Decode only the generated part
generated = outputs[0][inputs["input_ids"].shape[1]:]
translation = tokenizer.decode(generated, skip_special_tokens=True)
print(translation)

Without Quantization (Full Precision)

python
# For GPUs with sufficient memory (>24GB for larger models)
base_model = AutoModelForCausalLM.from_pretrained(
    "CohereLabs/tiny-aya-global",
    device_map="auto",
    torch_dtype=torch.bfloat16,
)
model = PeftModel.from_pretrained(base_model, "dsfsi/tiny_aya_global-lora-r64-nso-eng")

Training Details

Hyperparameters

ParameterValue
LoRA Rank (r)64
LoRA Alpha128
LoRA Dropout0.05
Target Modulesqproj, kproj, vproj, oproj, gateproj, upproj, down_proj
Epochs3
Batch Size2
Learning Rate2e-04
Max Sequence Length512
Gradient Accumulation4

Hardware Requirements

ConfigurationVRAM Required
4-bit (QLoRA)~8-12 GB
8-bit~16-20 GB
Full precision~24-40 GB

Reproducibility

To reproduce this adapter:

bash
# Clone the AfriScience-MT repository
git clone https://github.com/afriscience-mt/afriscience-mt.git
cd afriscience-mt

# Install dependencies
pip install -r requirements.txt

# Run LoRA training
python -m afriscience_mt.scripts.run_lora_training \
    --data_dir ./data \
    --source_lang nso \
    --target_lang eng \
    --model_name CohereLabs/tiny-aya-global \
    --model_type causal \
    --lora_rank 64 \
    --output_dir ./output \
    --num_epochs 3 \
    --batch_size 4 \
    --load_in_4bit

Limitations

  • —Domain Specificity: Optimized for scientific/academic texts; may underperform on casual or colloquial language.
  • —Language Direction: Only supports Northern Sotho → English translation.
  • —Base Model Required: Must be used with the CohereLabs/tiny-aya-global base model.
  • —Context Length: Maximum context is model-dependent; longer texts should be chunked.

Citation

If you use this model, please cite the AfriScience-MT paper (arXiv:2605.29741):

bibtex
@article{abdulmumin2026afriscience,
  title   = {AfriScience-MT: Towards Decolonizing Science in Africa through Text Translation},
  author  = {Abdulmumin, Idris and Gwadabe, Tajuddeen and Muhammad, Shamsuddeen Hassan and Adelani, David Ifeoluwa and Khalo, Nomonde and Ahmad, Ibrahim Said and Modupe, Abiodun and Mumm, Anina and Biyela, Sibusiso and Rabie, Michelle and Havemann, Johanna and Rei, Marek and Abbott, Jade and Marivate, Vukosi},
  journal = {arXiv preprint arXiv:2605.29741},
  year    = {2026},
  url     = {https://arxiv.org/abs/2605.29741}
}

License

This adapter is released under the Apache 2.0 License.

Acknowledgments