Views
No views yet
nxrt Python API. It
demonstrates onnx-genai's canonical inference_metadata.yaml format, which is
the authoritative contract in this package. genai_config.json is retained only
for ecosystem compatibility.pipeline.workflow. The autoregressive loop
is data, not runtime-specific code: the decoder graph and the ten token-policy
graphs under policies/ are declared as workflow components, all 28 key/value
cache pairs are threaded through serving.state_service groups, and sampling,
termination, and length bookkeeping are ONNX graphs the runtime executes like
any other component. The package therefore runs on the generic workflow runtime
with no decoder-specific lowering step.model.io section. That legacy form described a single decoder in a
shape only a special-cased decoder loader could execute; it is not supported.1python3 -m pip install nxrt
2ONNX_GENAI_KV_MAX_LEN=128 python3 - <<'PY'
3import nxrt
4
5engine = nxrt.genai.Engine.from_dir(".")
6result = engine.generate(
7 "Answer in one concise sentence: What is Rust?\nAnswer:",
8 max_tokens=18,
9 temperature=0.0,
10)
11print(result.text)
12print(result.token_ids)
13print(result.finish_reason)
14PYnxrt==0.1.0.dev3 and CPUExecutionProvider:1 Rust is a programming language that allows for high performance and is widely used in various industries.
2[33789, 374, 264, 15473, 4128, 429, 6147, 369, 1550, 5068, 323, 374, 13570, 1483, 304, 5257, 19102, 382]
3max_tokensONNX_GENAI_KV_MAX_LEN limits the shared KV allocation for this short example;
the model metadata preserves the full 131,072-token context limit.LICENSE and the upstream model card.inference_metadata.annotated.yaml for inline explanations of this package's workflow, tensor/state/cache contracts, and fail-closed omissions. inference_metadata.yaml remains the canonical machine-authored contract; automated validation confirms both files parse to the same metadata object.