Skip to content

Latest commit

 

History

History

runtime

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

interscript-ml (Python runtime) — SUPERSEDED by secryst

Deprecated. The canonical Python crystal is secryst (same code, same IMF v1 contract, same SECRYST_INDEX/SECRYST_CACHE env vars) — pip install secryst instead. This package remains published for provenance; runtime/ in this repo is the frozen origin of the crystal family (golden-owner history in the secryst-py README).

The reference Python runtime for IMF v1 model zips — the phonological layer of Interscript. The Ruby (secryst gem) and TypeScript (@interscript/ml) runtimes are diffed against this one on shared golden sets.

from interscript_ml import Model

model = Model.load("khm-latn-1.0")        # id: index resolve -> download
                                          # -> sha256-verify -> cache -> load
model.translate("ភាសា")                   # -> "pheasaea"
model.id                                   # "khm-latn-1.0"

model = Model.load("khm-latn-1.0.zip")    # or: a local zip path directly
  • Byte-level only: the canonical ByT5 table (byte b → id b+3, trailing EOS) — no vocab files, no per-model tokenization code.
  • Greedy KV-cache decode when the zip ships decoder-kv.onnx (default), plain full-recompute fallback otherwise.
  • Every .onnx member is sha256-verified against metadata.yaml before the session is created; corrupt downloads fail loudly.
  • Dynamic fetch per the models.yaml contract (shared with the Ruby and TypeScript runtimes): resolve id -> channel URL, download to temp, verify whole-file sha256 against the index, atomically install into ~/.cache/interscript/models/<id>/. Overrides: SECRYST_INDEX (URL or path), SECRYST_CACHE.

Install: pip install ./runtime (from the interscript-ml checkout) or pip install -e "./runtime[dev]" for development.

Tests: python -m pytest runtime/tests — tiny-graph zips, no torch needed. The end-to-end golden test runs when SECRYST_E2E_ZIP points at a real zip (e.g. models/khm-latn/khm-latn-1.0-fp32.zip) and asserts byte-identical outputs against golden/khm-latn-100.jsonl.

License: BSD-3-Clause.