Metadata-Version: 2.5
Name: brainers-atlasforge
Version: 0.1.0a2
Summary: Run, evaluate, compare and fine-tune the official N-ATLaS models (Hausa, Yoruba, Igbo, Nigerian English).
Project-URL: Homepage, https://github.com/Brainers-Labs/atlasforge
Project-URL: Issues, https://github.com/Brainers-Labs/atlasforge/issues
Author: Brainers Labs
License-Expression: Apache-2.0
License-File: LICENSE
Keywords: asr,evaluation,fine-tuning,hausa,igbo,llm,n-atlas,nigeria,yoruba
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Typing :: Typed
Requires-Python: >=3.10
Requires-Dist: httpx>=0.27
Requires-Dist: jiwer>=3.0
Requires-Dist: numpy>=1.26
Requires-Dist: rich>=13.7
Requires-Dist: sacrebleu>=2.4
Requires-Dist: tomli>=2.0; python_version < '3.11'
Requires-Dist: typer>=0.12
Provides-Extra: asr
Requires-Dist: huggingface-hub>=0.24; extra == 'asr'
Requires-Dist: librosa>=0.10; extra == 'asr'
Requires-Dist: soundfile>=0.12; extra == 'asr'
Requires-Dist: torch>=2.2; extra == 'asr'
Requires-Dist: transformers>=4.44; extra == 'asr'
Provides-Extra: bench
Requires-Dist: accelerate>=0.33; extra == 'bench'
Requires-Dist: lm-eval>=0.4; extra == 'bench'
Requires-Dist: torch>=2.2; extra == 'bench'
Requires-Dist: transformers>=4.44; extra == 'bench'
Provides-Extra: dev
Requires-Dist: mkdocs-macros-plugin>=1.0; extra == 'dev'
Requires-Dist: mkdocs-material>=9.5; extra == 'dev'
Requires-Dist: mkdocs<2,>=1.6; extra == 'dev'
Requires-Dist: mkdocstrings[python]>=0.26; extra == 'dev'
Requires-Dist: mypy>=1.11; extra == 'dev'
Requires-Dist: pip-audit>=2.7; extra == 'dev'
Requires-Dist: pre-commit>=3.8; extra == 'dev'
Requires-Dist: pytest-cov>=5.0; extra == 'dev'
Requires-Dist: pytest>=8.2; extra == 'dev'
Requires-Dist: pyyaml>=6.0; extra == 'dev'
Requires-Dist: ruff>=0.9; extra == 'dev'
Requires-Dist: tomli>=2.0; extra == 'dev'
Requires-Dist: types-pyyaml>=6.0; extra == 'dev'
Provides-Extra: docs
Requires-Dist: mkdocs-macros-plugin>=1.0; extra == 'docs'
Requires-Dist: mkdocs-material>=9.5; extra == 'docs'
Requires-Dist: mkdocs<2,>=1.6; extra == 'docs'
Requires-Dist: mkdocstrings[python]>=0.26; extra == 'docs'
Provides-Extra: finetune
Requires-Dist: accelerate>=0.33; extra == 'finetune'
Requires-Dist: bitsandbytes>=0.43; (sys_platform != 'darwin') and extra == 'finetune'
Requires-Dist: datasets>=2.20; extra == 'finetune'
Requires-Dist: huggingface-hub>=0.24; extra == 'finetune'
Requires-Dist: peft>=0.12; extra == 'finetune'
Requires-Dist: pyyaml>=6.0; extra == 'finetune'
Requires-Dist: safetensors>=0.4; extra == 'finetune'
Requires-Dist: torch>=2.2; extra == 'finetune'
Requires-Dist: transformers>=4.44; extra == 'finetune'
Requires-Dist: trl>=0.9; extra == 'finetune'
Provides-Extra: local
Requires-Dist: accelerate>=0.33; extra == 'local'
Requires-Dist: bitsandbytes>=0.43; (sys_platform != 'darwin') and extra == 'local'
Requires-Dist: huggingface-hub>=0.24; extra == 'local'
Requires-Dist: safetensors>=0.4; extra == 'local'
Requires-Dist: torch>=2.2; extra == 'local'
Requires-Dist: transformers>=4.44; extra == 'local'
Description-Content-Type: text/markdown

# AtlasForge

Run, evaluate, compare and fine-tune the official **N-ATLaS** models (Hausa, Yoruba, Igbo, Nigerian-accented English).

> **Status: pre-alpha (`0.1.0a2`, published to PyPI as `brainers-atlasforge`).** Built for NAIC 2026, Problem 01 (Developer Infrastructure). Everything under "Works today" is tested. Several parts have **never been run against real N-ATLaS weights** because they need a GPU or a large-memory machine: the `local` backend, the ASR models and fine-tuning. They are marked below. Nothing is claimed to work until it is listed here.

## Documentation

Full documentation (quickstart, concepts, guides, reference, troubleshooting) lives in [`docs/`](https://github.com/Brainers-Labs/atlasforge/blob/main/docs/index.md) and builds into a searchable site:

```bash
pip install -e ".[docs]"
mkdocs serve        # live preview
```

No model? Start with the offline demo: `atlasforge demo`. A Jupyter/Colab walkthrough of the whole workflow on that demo data is in [`notebooks/`](https://github.com/Brainers-Labs/atlasforge/blob/main/notebooks/README.md), and the output it produces — a report and a comparison in Markdown, JSON and HTML — is committed in [`examples/reports/`](https://github.com/Brainers-Labs/atlasforge/blob/main/examples/README.md).

## The question AtlasForge answers

> *I changed this N-ATLaS model. Did I actually make it better on my task, and where did it get worse?*

N-ATLaS is published as gated open weights on Hugging Face, so developers get the models but no tooling to measure them on their own data. AtlasForge is that tooling.

## Install

Python 3.10 to 3.13.

```bash
pip install --pre brainers-atlasforge
atlasforge --version
```

The distribution is `brainers-atlasforge`, not `atlasforge` — that name on PyPI belongs to an unrelated bioinformatics project. It is a pre-release, so `--pre` is required; without it pip will not see it. The import name and the command are both `atlasforge`.

To work on AtlasForge itself, or to run the tip of `main` rather than a release:

```bash
git clone https://github.com/Brainers-Labs/atlasforge
cd atlasforge
python -m venv .venv
. .venv/bin/activate                 # Windows PowerShell: .venv\Scripts\Activate.ps1
pip install -e .
```

That base install pulls in no PyTorch and no other machine-learning framework. Extras add one job at a time — `pip install "brainers-atlasforge[local]"` to run the weights in-process, `[asr]` for speech, `[finetune]` for QLoRA. [Installation](https://github.com/Brainers-Labs/atlasforge/blob/main/docs/get-started/installation.md) lists them all, and the [Quickstart](https://github.com/Brainers-Labs/atlasforge/blob/main/docs/get-started/quickstart.md) reaches a real comparison in about two minutes with no model at all.

## Works today

```bash
atlasforge doctor                                   # Python, GPU/VRAM, disk, ffmpeg, HF token, extras
atlasforge run "Ina kwana?" --base-url http://127.0.0.1:8000/v1
atlasforge dataset validate data.jsonl --task generation [--against test.jsonl]
atlasforge eval data.jsonl --out runs/base --base-url http://127.0.0.1:8000/v1 --model NCAIR1/N-ATLaS
atlasforge eval data.jsonl --out runs/tuned --base-url http://127.0.0.1:8001/v1 --model my-finetune
atlasforge compare data.jsonl --base runs/base --candidate runs/tuned --out cmp --slice domain
atlasforge report runs/base --dataset data.jsonl    # re-score with no model
atlasforge transcribe note.ogg --lang ha --base-url ...
```

- **`eval`**: JSONL in, resumable run out, `report.md` + `report.json` + `report.html` (one self-contained page: no JavaScript, no network, no server). Every text metric is reported under both a **tone-aware** and a **tone-insensitive** view (Yoruba/Igbo underdots and Hausa hooked letters are never stripped). Failed calls count as wrong.

- **`compare`**: paired bootstrap confidence intervals, an exact McNemar test for right/wrong metrics, per-slice results (language, length, has-number, or any `meta` field), and the same three report shapes as `eval`. A change is only called *improved* or *regressed* when the whole interval is on one side of zero, and slices under 30 examples are reported as *insufficient data*.
- **`dataset validate`**: malformed lines (all of them, with line numbers), duplicates, conflicting labels, train/test leakage, broken Unicode, stripped diacritics, class imbalance.
- **Backends**: `openai` works with any OpenAI-compatible server (vLLM, llama.cpp, Ollama, HF Endpoints, community gateways). It retries 429/5xx and connection errors, and never puts response bodies in error messages.
- **Safety nets**: `eval` stops after 20 consecutive failures instead of hammering a dead server, and keeps everything finished so it can resume.
- **`finetune --dry-run`** (no GPU): validates the training data, refuses train/test leakage and tiny datasets, and prints the plan. **`card`** writes a model card with the licence obligations (attribution, "Powered by Awarri", the 1,000-user cap), the evaluation numbers and any regressions.
- **ASR helpers**: any audio format via ffmpeg (including WhatsApp `.ogg`/opus), automatic splitting of audio over the models' 30-second limit, transcript merging.

## Not yet run against real weights

- `--backend local` (transformers): wiring is tested with stand-in modules only.
- Official ASR models: the chunking and merging are tested; the models themselves have not been loaded.
- `atlasforge finetune` (QLoRA via PEFT/TRL): data checks and `--dry-run` are tested; the training run itself needs an NVIDIA GPU and has never been executed.
- `--backend local --adapter DIR`: evaluating a fine-tuned adapter; wiring tested with stand-ins only.

Nothing above has been checked from a machine that has the weights. `scripts/live_smoke.py` is the run that does it, and it writes down what it saw — including the checks it could not perform. **It has not been run either.** The [project status](https://github.com/Brainers-Labs/atlasforge/blob/main/docs/help/status.md) page is the record.

## Metrics

exact match, accuracy, macro-F1, chrF / chrF++, WER, CER, latency percentiles. Datasets are JSONL, one example per line: `id`, `input` (or `messages`), `reference`, `lang`, `meta`; ASR uses `audio` instead of `input`. Unknown keys are rejected, so typos fail loudly.

## Models and licence

AtlasForge **never redistributes** N-ATLaS weights. You download them from Hugging Face after accepting the Awarri licence yourself. The licence includes a 1,000 active-end-user cap, attribution requirements and a "Powered by Awarri" suffix for derivatives. Read it before you build on the models. AtlasForge's own code is Apache-2.0.

## Development

```bash
python -m venv .venv && . .venv/bin/activate     # Windows: .venv\Scripts\activate
pip install -e ".[dev]"
pytest && ruff check . && ruff format --check . && mypy
```

The default test suite needs no GPU, credentials or gated weights. Extras: `[local]` (transformers backend), `[asr]`, `[finetune]`. ffmpeg is needed for audio.
