Skip to content

Commit 468c11c

Browse files
committed
docs: add README with architecture, setup, and usage
1 parent b0c626c commit 468c11c

1 file changed

Lines changed: 57 additions & 0 deletions

File tree

README.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Darija Translator
2+
3+
Fine-tuning LFM2.5-230M for English↔Darija translation with LoRA (Unsloth + TRL).
4+
5+
## Architecture
6+
7+
Pipeline-stage layout, not layered/hexagonal — this is a training pipeline, not a
8+
domain-rich application, so the structure follows the stages data moves through
9+
rather than DDD-style layers:
10+
11+
src/darija_translator/
12+
├── config.py # DataConfig, ModelConfig, TrainConfig — frozen dataclasses
13+
├── data.py # filtering, chat formatting, length filtering, split
14+
├── model.py # load base model + attach LoRA (Unsloth)
15+
├── train.py # SFTTrainer wiring, wandb tracking
16+
├── evaluate.py # BLEU/chrF scoring + generation
17+
└── cli.py #`darija-translator train` / `evaluate`
18+
19+
Pure logic (`data.py`, `evaluate.py`'s `compute_translation_metrics`, all of
20+
`config.py`) is unit-tested. Model/training code (`model.py`, `train.py`,
21+
`generate_translations`) isn't — it's an integration point with a real model
22+
and GPU, verified instead via manual smoke-test scripts in `scripts/`.
23+
24+
## Setup
25+
26+
uv sync --group dev --group eval # run the test suite, no GPU needed
27+
uv run pytest -v
28+
29+
For training/evaluation on GPU, also install:
30+
31+
uv sync --group train
32+
33+
### W&B tracking
34+
35+
Training reports to Weights & Biases by default.
36+
37+
cp .env.example .env
38+
# fill in WANDB_API_KEY from https://wandb.ai/authorize
39+
40+
## Training (requires GPU)
41+
42+
uv run darija-translator train
43+
44+
## Evaluation
45+
46+
uv run darija-translator evaluate
47+
48+
Reports BLEU and chrF on the held-out split.
49+
50+
## Results
51+
52+
<!-- fill in once trained: BLEU/chrF on held-out set, training curves link -->
53+
54+
## Original exploration
55+
56+
The initial SFT experiment (before this repo existed) is kept at
57+
`notebooks/01_exploration.ipynb` for reference.

0 commit comments

Comments
 (0)