feat(ml): IMF v1 runtime — index resolution, sha256 verification, KV decode (WO05) - #9
Open
ronaldtse wants to merge 1 commit into
Open
feat(ml): IMF v1 runtime — index resolution, sha256 verification, KV decode (WO05)#9ronaldtse wants to merge 1 commit into
ronaldtse wants to merge 1 commit into
Conversation
…decode The TypeScript binding of interscript-ml, implementing the models.yaml contract shared with the Python (interscript-ml) and Ruby (secryst gem) runtimes: - tokens: canonical ByT5 table (byte b -> id b+3, trailing EOS); ids are NOT raw TextEncoder bytes - loader: fflate unzip + js-yaml manifest; every .onnx member sha256-verified via WebCrypto before any session is created - registry: models.yaml resolution — verified cache hit in ~/.cache/interscript (node fs, atomic rename) or download -> whole-file sha256 verify; INTERSCRIPT_ML_INDEX/CACHE overrides match the other runtimes - IMFModel: greedy KV-cache decode when the zip ships decoder-kv.onnx, plain fallback; zero-length step-0 pasts from session inputMetadata (exposed through the node session wrapper; byt5-small fallback dims) - session: optional inputMetadata on InferenceSession (additive) Verified against the released khm-latn-1.0: 100/100 golden-set outputs byte-identical to the Python and Ruby runtimes (three runtimes, one golden set). package-lock.json includes pre-existing in-flight dependency state on this branch's base.
Contributor
Author
|
CI note: Build+Test and Coverage fail on this PR, but they fail |
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
The TypeScript binding of interscript-ml (WO05): an IMF v1 runtime
under
src/ml/imf/, implementing themodels.yamlcontract shared withthe Python reference (
interscript-ml) and the Ruby binding (secrystPR #45). Stacked on #5; retarget when it merges.
What's here
b→ idb+3, trailingEOS). Ids are NOT raw
TextEncoderbytes..onnxmembersha256-verified via WebCrypto before any session is created.
~/.cache/interscript/models/<id>/(node fs, atomic rename), ordownload → whole-file sha256 verify. Env overrides match the other
runtimes (
INTERSCRIPT_ML_INDEX,INTERSCRIPT_ML_CACHE).decoder-kv.onnx(default), plain full-recompute fallback;zero-length step-0 pasts sized from session
inputMetadata(nowexposed through the node session wrapper — additive interface change).
fflate,js-yaml(+types),onnxruntime-nodeas devDep.Cross-runtime acceptance
Released
khm-latn-1.0(interscript/ml-models): 100/100 golden-setoutputs byte-identical across TypeScript, Python, and Ruby —
golden/khm-latn-100.jsonlis the shared contract.Test plan
registry install/cache-hit/unknown-id, session loading from the
committed tiny IMF fixture, golden e2e gated on
INTERSCRIPT_TS_E2E_ZIP)tscclean (exactOptionalPropertyTypes honored); full suite241 tests green
Note:
package-lock.jsoncarries the base branch's pre-existingin-flight dependency state alongside the two new deps.