feat(runtime): interscript-ml — Python IMF v1 runtime (WO06) - #4
Merged
Conversation
ronaldtse
force-pushed
the
feat/imf-python
branch
from
August 16, 2026 09:07
533b7f2 to
f02c52f
Compare
added 3 commits
August 16, 2026 17:11
The reference implementation Ruby/TS are diffed against: - Model.load(zip): manifest parse, every .onnx sha256-verified before the session is built (corrupt downloads fail loudly), sessions from verified bytes — no temp files - greedy KV decode when the zip ships decoder-kv.onnx, plain full-recompute fallback otherwise - tokens.py: the canonical ByT5 table (byte+3, trailing EOS) as the single source of the convention - own distribution (runtime/pyproject.toml -> 'interscript-ml'), no dependency on the training repo, torch-free - tests: tiny-graph zips for CI (load, decode, tamper rejection, tokenizer/format rejection) + an e2e golden test gated on INTERSCRIPT_ML_E2E_ZIP; verified locally against khm-latn-1.0-fp32: 100/100 golden outputs byte-identical
transformers 5.15 breaks T5 tracing ('multiple values for use_cache') —
the same regression seen on Modal; CI was installing unpinned latest.
The runtime tests build their tiny-graph zips with the onnx package.
The release/fetch contract shared by all three runtimes, documented in
models.yaml: resolve id -> channel URL -> download to temp -> verify
whole-file sha256 against the index -> atomic install into
~/.cache/interscript/models/<id>/. Cache hits are re-verified; file://
channels copy (mirrors, not moves). Model.load now accepts an id or a
zip path. First entry: khm-latn-1.0 fp32 (gated: 0.0pp parity on 895
samples) pointing at the pending khm-latn-1.0 GitHub release.
Verified end-to-end against the real gated zip through a local channel:
Model.load('khm-latn-1.0') -> 'rok' / 'pheasaea'.
ronaldtse
force-pushed
the
feat/imf-python
branch
from
August 16, 2026 09:11
f02c52f to
0515708
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Work order TODO.runtime-arch/06: interscript-ml, the Python runtime
for IMF v1 zips — the reference implementation the Ruby (secryst) and
TypeScript (@interscript/ml) runtimes are diffed against.
Stacked on #3 (
feat/imf-export); retarget tomainwhen the stack merges.What's here
runtime/— its own distribution (pip install ./runtime→interscript-ml), depending only on onnxruntime + pyyaml + numpy.No torch, no training-repo coupling.
Model.load(zip):bytestokenizers and non-IMF formats.onnxmember before building sessions —the corrupt-download failure mode fails loudly (this is not
theoretical: the fp32 khm zip on the checkpoint volume has a CRC
error in encoder.onnx)
decoder-kv.onnx(the default artifact), plain full-recompute fallback otherwise.
tokens.py: the canonical ByT5 table (byteb→ idb+3, trailingEOS) — the single source of the convention documented in
docs/imf-v1.md after the silent-garbage incident.
Verification
pip wheel ./runtimebuildsinterscript_ml-0.1.0-py3-none-any.whlrejection, tokenizer/format rejection, missing-graph rejection
INTERSCRIPT_ML_E2E_ZIP=...khm-latn-1.0-fp32.zip):100/100 golden-set outputs byte-identical
python-runtime