Metadata-Version: 2.4
Name: altamt
Version: 1.0
Summary: ALTAMT: Advanced Lightweight Translation AI Model Transformer - bidirectional Kinyarwanda <-> English machine translation optimized for CPU inference.
Author: ALTAMT Contributors
License: Apache-2.0
Project-URL: Homepage, https://github.com/altamt-ai/altamt
Project-URL: Documentation, https://github.com/altamt-ai/altamt#readme
Project-URL: Issues, https://github.com/altamt-ai/altamt/issues
Keywords: machine-translation,kinyarwanda,nlp,transformer,low-resource,onnx,quantization
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Text Processing :: Linguistic
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: torch>=2.1
Requires-Dist: sentencepiece>=0.1.99
Requires-Dist: numpy>=1.24
Requires-Dist: pandas>=2.0
Requires-Dist: pyarrow>=14.0
Requires-Dist: sacrebleu>=2.4
Requires-Dist: pyyaml>=6.0
Requires-Dist: tqdm>=4.66
Provides-Extra: onnx
Requires-Dist: onnx>=1.15; extra == "onnx"
Requires-Dist: onnxruntime>=1.17; extra == "onnx"
Provides-Extra: benchmark
Requires-Dist: transformers>=4.40; extra == "benchmark"
Requires-Dist: evaluate>=0.4; extra == "benchmark"
Requires-Dist: psutil>=5.9; extra == "benchmark"
Provides-Extra: dev
Requires-Dist: pytest>=7.4; extra == "dev"
Requires-Dist: ruff>=0.4; extra == "dev"
Requires-Dist: mypy>=1.8; extra == "dev"
Requires-Dist: build; extra == "dev"
Requires-Dist: twine; extra == "dev"
Provides-Extra: all
Requires-Dist: altamt[benchmark,dev,onnx]; extra == "all"
Dynamic: license-file

# altamt

**Bidirectional Kinyarwanda ⇄ English machine translation — fast on your CPU.**

`altamt` (Advanced Lightweight Translation AI Model Transformer) is a compact (~130–195M parameter) modern Transformer (RMSNorm · SwiGLU · Grouped-Query Attention · RoPE) that translates in **both directions with one model** and **auto-detects the input language**. No GPU required.

## Installation

```bash
pip install altamt
# optional extras
pip install "altamt[onnx]"        # ONNX Runtime export & inference
pip install "altamt[benchmark]"   # compare against NLLB / Opus-MT baselines
```

## Quickstart (Python)

```python
from altamt import Translator

translator = Translator(model_path="path/to/checkpoint")

# Language auto-detection: just pass text.
result = translator.translate("Mwaramutse nshuti zanjye")
print(result)
# {'translated_text': 'Good morning my friends',
#  'detected_src': 'rw', 'tgt': 'en', 'latency_ms': 42.1}

# Or pin the direction explicitly:
translator.translate("How are you today?", src_lang="en", tgt_lang="rw")

# Batch translation — directions can even be mixed in one batch:
translator.translate_batch(["Mwaramutse", "Good morning"])
```

### Make it faster: INT8 quantization

```python
translator = Translator("path/to/checkpoint", quantize=True, num_threads=8)
translator.warmup()
```

INT8 dynamic quantization typically gives ~2× lower latency and ~4× smaller weight matrices on x86 CPUs, with a negligible quality drop.

## Quickstart (CLI)

```bash
altamt translate "Mwaramutse nshuti zanjye" --model path/to/checkpoint
# Good morning my friends
# [rw -> en | 42.1 ms]

altamt translate "Hello" --model path/to/checkpoint --tgt-lang rw --int8 --json

altamt benchmark  --model path/to/checkpoint --test-file test.parquet --int8
altamt export-onnx --model path/to/checkpoint --output-dir ./onnx_model
altamt train      --config config.yaml
```

## Why altamt?

- **One model, both directions** — a target-language tag (`<2en>` / `<2rw>`) steers the decoder, so RW→EN and EN→RW share all parameters and vocabulary.
- **Automatic language detection** — a built-in, microsecond-fast character n-gram detector picks the direction when you don't.
- **Built for CPU** — Grouped-Query Attention + full KV-cached decoding + INT8 quantization target <100 ms per sentence on a modern 8-core CPU (beam=1, short sentences).
- **Multi-format data** — training and benchmarking read `.json`, `.jsonl` and `.parquet` interchangeably.
- **Honest benchmarking** — `altamt benchmark` reports SacreBLEU, chrF++, latency, throughput and memory, and can run NLLB/Opus-MT baselines through the same harness, emitting Markdown and LaTeX tables.

## Indicative CPU performance

Numbers depend on your hardware, sentence length, beam size and thread count; measure on your machine with `altamt benchmark`. On a modern 8-core x86 CPU (beam=1, ~20-token sentences, `num_threads=8`), the INT8 `base` model targets **<100 ms/sentence**, with fp32 roughly 2× slower and ~780 MB peak RAM.

## Documentation

Full architecture details, data format specs, training and paper-publishing guides live in the [GitHub README](https://github.com/altamt-ai/altamt#readme).

## License

Apache 2.0
