Logo Lanfrica

K-AI-ML/acoli-nmt-library

Domaine:

natural language processing

Type de record:

softwaremodel
Créateur:
K-A
HĂ´te:
# 🌍 Acoli NMT — Acoli ↔ English Neural Machine Translation A complete library for training, evaluating, and serving Acoli (Acholi) ↔ English translation models. Built on NLLB-200 with LoRA fine-tuning, optimized for low-resource settings. ## Install ```bash # From source git clone github.com cd acoli-nmt pip install -e ".[all]" # Or just the core (no Gradio/COMET) pip install -e . ``` **Requirements:** Python ≥3.9, PyTorch ≥2.1, CUDA recommended (runs on CPU but slow). ## Quick Start — Python API ```python from acoli_nmt import Config, Trainer, Translator # ── Train from scratch ────────────────────────────────────────────── cfg = Config(epochs=3, lr=1e-4, batch_size=16) trainer = Trainer(cfg) trainer.load_data() # downloads & merges 5 parallel corpora trainer.train() # fine-tunes NLLB-200 with LoRA metrics = trainer.evaluate() # bidirectional BLEU/chrF/COMET trainer.save("./my-model") # ── Translate with a trained model ────────────────────────────────── t = Translator.from_pretrained("./my-model") t.en_to_ach("How are you today?") t.ach_to_en("Itye nining?") t.translate_batch(["Hello", "Thank you"], direction="en2ach") ``` ## CLI Commands ```bash # Train (downloads data automatically) acoli-train --epochs 5 --lr 1e-4 --save-dir ./my-model # Evaluate a trained model acoli-eval ./my-model # Translate text acoli-translate ./my-model "How are you today?" acoli-translate ./my-model -d ach2en "Itye nining?" # Pipe mode (one sentence per line) cat sentences.txt | acoli-translate ./my-model # Launch Gradio web UI acoli-serve ./my-model --share acoli-serve ./my-model --port 8080 ``` ## Gradio UI After training, launch an interactive translation dashboard: ```bash acoli-serve ./my-model --share ``` This gives you: - **Translate tab** — type text, pick direction, get translation + optional BLEU/chrF scoring - **Batch tab** — paste multiple sentences, translate all at once - **Gallery tab** — run bui …