Getting started¶
Install¶
pip install yellowmist
Python 3.9+. Depends only on numpy, onnxruntime, huggingface_hub and tokenizers; no PyTorch.
npm install yellowmist
Browser and Node 18+. Runs on onnxruntime-web by default.
Your first call¶
import yellowmist as ym
print(ym.punct("hello how are you i hope you are well", "eng_Latn"))
The first call downloads the model for that language's region (about 16 MB) and caches it. Later calls are local.
Languages¶
Every call takes a FLORES-style language label: a three-letter language code and the script, joined by _.
| Label | Language |
|---|---|
yor_Latn |
Yoruba |
hau_Latn |
Hausa |
swh_Latn |
Swahili |
hin_Deva |
Hindi in Devanagari |
hin_Latn |
Hindi in Latin letters (Hinglish) |
arb_Arab |
Modern Standard Arabic |
tha_Thai |
Thai |
ym.languages("punct") lists every label a task supports. A wrong label gives an error with suggestions.
Models are grouped into 12 regions: WA (West Africa), ESA (Central, East and Southern Africa), AMR (Americas), AP (Asia-Pacific, Latin script), EU (Europe), AR (Arabic script), INN (North Indic), INS (South Indic), CY (Cyrillic), ET (Ethiopic), OA (Greek, Hebrew, Georgian, Armenian, Thaana and more) and SEA (Thai, Lao, Khmer, Burmese, Tibetan). The library picks the region from the language label.
Caching and offline use¶
- Python: files go to the Hugging Face cache.
YELLOWMIST_CACHEsets the folder; after the first download,HF_HUB_OFFLINE=1runs fully offline. - Browser: files are kept with the Cache API.
- Node: files go to
~/.cache/yellowmist(orYELLOWMIST_CACHE).
Load a model at start-up so the first real call is fast:
ym.preload("punct", lang="yor_Latn")
Precision¶
Models run in int8 by default: at release, every model's int8 file matches the full-precision model on at least 99%
of characters. Pass precision="fp32" to force full precision, or "int8" to force the smaller file.
Versions¶
Each release pins the exact model versions it was tested with, so results do not change under you. Upgrading the package brings the newest models.