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
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
model_id = "AfriScience-MT/m2m100_418m-eng-lug"
model = AutoModelForSeq2SeqLM.from_pretrained(model_id)
tokenizer = AutoTokenizer.from_pretrained(model_id)
# Set source language
tokenizer.src_lang = "en"# Translate
text = "The mitochondria is the powerhouse of the cell."
inputs = tokenizer(text, return_tensors="pt", padding=True, truncation=True, max_length=256)
# Generate with target language
forced_bos_token_id = tokenizer.get_lang_id("lg")
outputs = model.generate(**inputs, forced_bos_token_id=forced_bos_token_id, max_length=256, num_beams=5)
translation = tokenizer.batch_decode(outputs, skip_special_tokens=True)[0]
print(translation)
Batch Translation
texts = [
"Climate change affects agricultural productivity.",
"The study analyzed genetic markers in the population.",
"Renewable energy sources are essential for sustainable development."
]
inputs = tokenizer(texts, return_tensors="pt", padding=True, truncation=True, max_length=256)
outputs = model.generate(**inputs, forced_bos_token_id=forced_bos_token_id, max_length=256, num_beams=5)
translations = tokenizer.batch_decode(outputs, skip_special_tokens=True)
for src, tgt inzip(texts, translations):
print(f"{src}\n→ {tgt}\n")
Training Details
Hyperparameters
Parameter
Value
Epochs
10
Batch Size
8
Learning Rate
2e-05
Training Data
Dataset
: AfriScience-MT
Domain
: Scientific abstracts and papers
Languages
: English and 6 African languages (Amharic, Hausa, Luganda, Northern Sotho, Yoruba, isiZulu)
Reproducibility
To reproduce this model:
# 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 training
python -m afriscience_mt.scripts.run_seq2seq_training \
--data_dir ./data \
--source_lang eng \
--target_lang lug \
--model_name facebook/m2m100_418M \
--model_type m2m100 \
--output_dir ./output \
--num_epochs 10 \
--batch_size 16 \
--learning_rate 2e-5
Limitations
Domain Specificity
: This model is optimized for scientific/academic texts and may perform poorly on colloquial or informal text.
Language Coverage
: Only supports the specific language pair indicated.
Input Length
: Maximum input length is 256 tokens; longer texts should be split into segments.
Citation
If you use this model, please cite the AfriScience-MT project:
m2m100_418m-eng-lug huggingface.co is an AI model on huggingface.co that provides m2m100_418m-eng-lug's model effect (), which can be used instantly with this AfriScience-MT m2m100_418m-eng-lug model. huggingface.co supports a free trial of the m2m100_418m-eng-lug model, and also provides paid use of the m2m100_418m-eng-lug. Support call m2m100_418m-eng-lug model through api, including Node.js, Python, http.
m2m100_418m-eng-lug huggingface.co is an online trial and call api platform, which integrates m2m100_418m-eng-lug's modeling effects, including api services, and provides a free online trial of m2m100_418m-eng-lug, you can try m2m100_418m-eng-lug online for free by clicking the link below.
AfriScience-MT m2m100_418m-eng-lug online free url in huggingface.co:
m2m100_418m-eng-lug is an open source model from GitHub that offers a free installation service, and any user can find m2m100_418m-eng-lug on GitHub to install. At the same time, huggingface.co provides the effect of m2m100_418m-eng-lug install, users can directly use m2m100_418m-eng-lug installed effect in huggingface.co for debugging and trial. It also supports api for free installation.
m2m100_418m-eng-lug install url in huggingface.co: