ONNX Runtime-backed text generation engine (same API as nxrt.genai)
Project description
onnx-genai
ONNX Runtime-backed text generation for Python.
onnx-genai exposes a small, high-level generation API implemented on
ONNX Runtime. It is the ONNX Runtime-compatible
counterpart of nxrt.genai: both packages present the same Engine /
GenerateResult API, but onnx_genai runs on ONNX Runtime while nxrt.genai
runs on the native nxrt runtime.
import onnx_genai
engine = onnx_genai.Engine.from_dir("path/to/model_dir")
result = engine.generate("Hello, world!", max_tokens=64, temperature=0.8)
print(result.text)
# Streaming
def on_token(text, token_id, finish_reason):
print(text, end="", flush=True)
engine.generate_stream("Tell me a story", on_token, max_tokens=128)
The model directory must contain the ONNX graph(s), tokenizer.json, and model
metadata (inference_metadata.yaml or genai_config.json).
Wheels
Distributed as stable-ABI (abi3) wheels tagged cp310-abi3, so a single wheel
per platform loads on CPython 3.10 and newer. The bundled ONNX Runtime shared
library is vendored into the wheel, so no separate ONNX Runtime installation is
required.
Related packages
nxrt— the low-level nxrt runtime (inference sessions, eager ops) plusnxrt.genai, the same generation API backed by the native runtime.onnx-genai-server— theonnx-genaicommand-line tool, including the OpenAI-compatible server (onnx-genai serve).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file onnx_genai-0.1.0.dev3.tar.gz.
File metadata
- Download URL: onnx_genai-0.1.0.dev3.tar.gz
- Upload date:
- Size: 2.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
deeb70eb416f4c50044cc3b3856d487b15cd0b4ee51a9b8ad8a762be4b09e705
|
|
| MD5 |
1c2d77e15ceb042ea673d46246ce71ad
|
|
| BLAKE2b-256 |
d49e9849d19364f412a569664abf15e88ad5bdf609e36116744b0dac07578206
|
Provenance
The following attestation bundles were made for onnx_genai-0.1.0.dev3.tar.gz:
Publisher:
publish.yml on justinchuby/onnx-genai
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
onnx_genai-0.1.0.dev3.tar.gz -
Subject digest:
deeb70eb416f4c50044cc3b3856d487b15cd0b4ee51a9b8ad8a762be4b09e705 - Sigstore transparency entry: 2209925523
- Sigstore integration time:
-
Permalink:
justinchuby/onnx-genai@d424e647f942dbe19955d633bdaf2acbb75ca7eb -
Branch / Tag:
refs/tags/v0.1.0-dev.3 - Owner: https://github.com/justinchuby
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d424e647f942dbe19955d633bdaf2acbb75ca7eb -
Trigger Event:
push
-
Statement type:
File details
Details for the file onnx_genai-0.1.0.dev3-cp310-abi3-win_arm64.whl.
File metadata
- Download URL: onnx_genai-0.1.0.dev3-cp310-abi3-win_arm64.whl
- Upload date:
- Size: 3.8 MB
- Tags: CPython 3.10+, Windows ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
26fa58352c3114767388fdc8e76e1c4a7aa9f63a3bdd9fabc82f8c86d6d40df3
|
|
| MD5 |
b5b5858e5460ab01ce9266c7d17e835d
|
|
| BLAKE2b-256 |
00eede8390f6f12d328cc65bb6aa01f1602330ea79efc604d6cca49bc22513f1
|
Provenance
The following attestation bundles were made for onnx_genai-0.1.0.dev3-cp310-abi3-win_arm64.whl:
Publisher:
publish.yml on justinchuby/onnx-genai
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
onnx_genai-0.1.0.dev3-cp310-abi3-win_arm64.whl -
Subject digest:
26fa58352c3114767388fdc8e76e1c4a7aa9f63a3bdd9fabc82f8c86d6d40df3 - Sigstore transparency entry: 2210331756
- Sigstore integration time:
-
Permalink:
justinchuby/onnx-genai@a4a344ae78be92ff6f92e2a2922438b6c1108e03 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/justinchuby
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a4a344ae78be92ff6f92e2a2922438b6c1108e03 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file onnx_genai-0.1.0.dev3-cp310-abi3-win_amd64.whl.
File metadata
- Download URL: onnx_genai-0.1.0.dev3-cp310-abi3-win_amd64.whl
- Upload date:
- Size: 4.1 MB
- Tags: CPython 3.10+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c14d997b2bdc0e7b4af66dfd87718784913268706c4a3099fbadadbc31b9c0e1
|
|
| MD5 |
d72636a77c1181923d9eb049f96114d7
|
|
| BLAKE2b-256 |
7a530fa4edea510e8021cca5ba28cfa71d1367b5ddb87b4ec3f30e7115db17a6
|
Provenance
The following attestation bundles were made for onnx_genai-0.1.0.dev3-cp310-abi3-win_amd64.whl:
Publisher:
publish.yml on justinchuby/onnx-genai
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
onnx_genai-0.1.0.dev3-cp310-abi3-win_amd64.whl -
Subject digest:
c14d997b2bdc0e7b4af66dfd87718784913268706c4a3099fbadadbc31b9c0e1 - Sigstore transparency entry: 2210244739
- Sigstore integration time:
-
Permalink:
justinchuby/onnx-genai@fee126ea038557a0c6f2b43c4c31e21af74ba84b -
Branch / Tag:
refs/heads/main - Owner: https://github.com/justinchuby
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@fee126ea038557a0c6f2b43c4c31e21af74ba84b -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file onnx_genai-0.1.0.dev3-cp310-abi3-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: onnx_genai-0.1.0.dev3-cp310-abi3-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 4.2 MB
- Tags: CPython 3.10+, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2763551601d66d41b99acd32198a83b9043079a43b15fb82ec6eb676f4523ab1
|
|
| MD5 |
7237fee9062e98c3aacfcde448f347b4
|
|
| BLAKE2b-256 |
0385d753ff32e811081d7669a6c851803b26615257386f8d760cd71677e5a3b4
|
Provenance
The following attestation bundles were made for onnx_genai-0.1.0.dev3-cp310-abi3-manylinux_2_28_x86_64.whl:
Publisher:
publish.yml on justinchuby/onnx-genai
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
onnx_genai-0.1.0.dev3-cp310-abi3-manylinux_2_28_x86_64.whl -
Subject digest:
2763551601d66d41b99acd32198a83b9043079a43b15fb82ec6eb676f4523ab1 - Sigstore transparency entry: 2210244619
- Sigstore integration time:
-
Permalink:
justinchuby/onnx-genai@fee126ea038557a0c6f2b43c4c31e21af74ba84b -
Branch / Tag:
refs/heads/main - Owner: https://github.com/justinchuby
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@fee126ea038557a0c6f2b43c4c31e21af74ba84b -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file onnx_genai-0.1.0.dev3-cp310-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: onnx_genai-0.1.0.dev3-cp310-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 3.8 MB
- Tags: CPython 3.10+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
29fb3a2a7b1a6de1f626c40491175eeb62a8ad19b70eccf596b46e3fe07e3a20
|
|
| MD5 |
511d1f35bf92f5ca768993c11edcf37f
|
|
| BLAKE2b-256 |
2dcbf36d1ce41e090fd19115d26ca347ca23d985650d81bcbb8ac909ff8b288e
|
Provenance
The following attestation bundles were made for onnx_genai-0.1.0.dev3-cp310-abi3-macosx_11_0_arm64.whl:
Publisher:
publish.yml on justinchuby/onnx-genai
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
onnx_genai-0.1.0.dev3-cp310-abi3-macosx_11_0_arm64.whl -
Subject digest:
29fb3a2a7b1a6de1f626c40491175eeb62a8ad19b70eccf596b46e3fe07e3a20 - Sigstore transparency entry: 2210244566
- Sigstore integration time:
-
Permalink:
justinchuby/onnx-genai@fee126ea038557a0c6f2b43c4c31e21af74ba84b -
Branch / Tag:
refs/heads/main - Owner: https://github.com/justinchuby
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@fee126ea038557a0c6f2b43c4c31e21af74ba84b -
Trigger Event:
workflow_dispatch
-
Statement type: