Skip to main content

aion-engine

Python bindings for Aion — a graph-IR tensor runtime with a Zig core, CPU and GPU. The distribution is aion-engine; the import name is aion.

Install

pip install aion-engine          # CPU
pip install aion-engine[gpu]     # + the GPU (wgpu) runtime

Prebuilt wheels for CPython 3.12/3.13 on Windows x64, Linux x86_64/aarch64 and macOS arm64/x86_64 — no Zig or C toolchain needed. The Aion runtime is static-linked into the extension module, so there is no separate aion.dll/libaion.so to ship or locate.

The GPU backend is compiled into those same wheels but links no wgpu — it dlopens wgpu-native at runtime. [gpu] adds the companion aion-wgpu wheel, which ships that library for every platform the runtime wheels target. Without it, GPU calls raise aion.AionError and CPU is unaffected.

NumPy is optional ([numpy] extra); without it use tensor.tolist() / tensor.item().

Run a model

A .aion file carries graph, weights and metadata, so this is the whole setup:

import aion, numpy as np

model = aion.load_model("model.aion")              # device="gpu" to run on GPU
out = model.run_numpy({"x": np.zeros((1, 4), "f4")})["y"]

In hot loops, bind tensors once (model.bind_input(name, t) + model.run()) instead of creating temporaries per step. KV caches and streaming state are managed by the runtime from the model's input roles — you don't thread them through Python (load_model(..., cache_capacity=, growable=) tunes it).

Build a model

Two handles, and they don't mix. aion.Tensor is data: what you write inputs into, read outputs from, and hand a layer as a weight. aion.TensorRef is a value in a graph: what ops and aion.nn layers take and return.

import aion, numpy as np
from aion import nn

ctx = aion.Context()
w = aion.tensor(np.random.randn(4, 3).astype("f4"))   # data

with aion.Builder(ctx) as b:
    x = b.input((1, 4)).rename("x")                   # TensorRef
    y = nn.Linear(w)(x).relu().rename("y")
    model = b.compile([y])

out = model.run_numpy({"x": np.ones((1, 4), "f4")})["y"]

For a reusable module, aion.compile(MyModule(), aion.spec((None, 4))) traces forward once (None = dynamic axis) and aion.export(..., "mlp.aion") writes the package. compile works on a copy of the graph, so authoring survives it: you can compile twice, and print(y) / y.numpy() evaluates just that value's cone while you keep building.

dtype takes Aion constants (aion.float32, float16, int8, int32, q8_0, q4_0) or NumPy dtypes — not strings.

GPU

ctx = aion.Context.gpu()                                  # first discrete adapter
model = aion.LoadedModel.load(ctx, "model.aion", device="gpu")

Keep feeding CPU input tensors: the model migrates them on run() and flushes outputs back for reading. A standalone tensor.to("gpu") is a move — the host copy is freed, so to("cpu") before reading it. device="gpu:1" (or adapter_index=) picks a physical adapter, power="low"/"high" picks integrated/discrete, and Context(gpus=[...]) registers several.

Examples

Runnable scripts in bindings/python/examples/, all taking --device {cpu,gpu,auto}:

silero_vad_simple.py chunked VAD, reports throughput
harrier_embed.py text embeddings, ranks documents against a query
nemotron_asr_streaming.py, nemotron_asr_mic.py streaming ASR from a wav or the mic
gemma4_e2b_generate_one.py LLM token generation

Models are produced by the converters in scripts/.

Developing from a checkout

uv sync        # environment + native build (dev group: numpy, torch, pytest, aion-wgpu)
uv run pytest

uv run rebuilds and relinks the extension when the Zig core changes — the uv cache key covers src/**/*.zig, the public headers and the build files. uv sync --reinstall-package aion-engine forces a rebuild.

Build knobs: AION_PY_OPTIMIZE (default ReleaseFast), AION_PY_CPU (native), AION_PY_TARGET, AION_PY_GPU (overrides [tool.aion] gpu in pyproject.toml). Building from source needs Zig on PATH plus a C toolchain.

Notes: prefer with for deterministic cleanup (Context.close() closes live tensors/models first); AION_DEFAULT_THREAD_COUNT sets the default context's thread count, and aion.reset_default_context() re-reads it.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

aion_engine-0.0.2-cp313-cp313-win_amd64.whl (1.6 MB view details)

Uploaded CPython 3.13Windows x86-64

aion_engine-0.0.2-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (6.3 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

aion_engine-0.0.2-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl (4.2 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

aion_engine-0.0.2-cp313-cp313-macosx_11_0_arm64.whl (1.5 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

aion_engine-0.0.2-cp312-cp312-win_amd64.whl (1.6 MB view details)

Uploaded CPython 3.12Windows x86-64

aion_engine-0.0.2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (6.3 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

aion_engine-0.0.2-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl (4.2 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

aion_engine-0.0.2-cp312-cp312-macosx_11_0_arm64.whl (1.5 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

Details for the file aion_engine-0.0.2-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for aion_engine-0.0.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 39a04eb43da47ca0d6449018544ac5e93afd0ccfa28f347ea17ac4042b3eed8b
MD5 1569530faf8bdadb5be42bf8968622b0
BLAKE2b-256 c85b18cd0532e507c6884f8548a5fb2ea1bd1562ff89061c2ade1a0ba87bc62d

See more details on using hashes here.

Provenance

The following attestation bundles were made for aion_engine-0.0.2-cp313-cp313-win_amd64.whl:

Publisher: publish.yml on RubyBit/aion

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file aion_engine-0.0.2-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for aion_engine-0.0.2-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 5926bde5a9327f823082581eec02538d39f653273b005f9854e8ae9410ac1cf6
MD5 b241425543fe363925d58c724125cf3f
BLAKE2b-256 1ffb08dd3d030b0112812a674b7a507fdbb1456e6b1c61feef90895e01fd6da2

See more details on using hashes here.

Provenance

The following attestation bundles were made for aion_engine-0.0.2-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl:

Publisher: publish.yml on RubyBit/aion

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file aion_engine-0.0.2-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl.

File metadata

File hashes

Hashes for aion_engine-0.0.2-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 f9febf10cb9488ccfb17d6920906bcde1e975564fabd492b913deb55296fa152
MD5 96644bb385e90899a0d75bf353d32410
BLAKE2b-256 2b00b9e02cf6eb5db5f4f7fe0fc9015307f5de2c77bbf8e47e1cee1cf4550dc5

See more details on using hashes here.

Provenance

The following attestation bundles were made for aion_engine-0.0.2-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl:

Publisher: publish.yml on RubyBit/aion

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file aion_engine-0.0.2-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for aion_engine-0.0.2-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1b82252bbdf797737a7aa901ef7976aa1f81631ce07273c6d9a911435365f957
MD5 0f33a01209485c862add96d3580d26ed
BLAKE2b-256 ff2459490677782d818346aae3b70cdfd459f1396d10d334263be27599c0442b

See more details on using hashes here.

Provenance

The following attestation bundles were made for aion_engine-0.0.2-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: publish.yml on RubyBit/aion

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file aion_engine-0.0.2-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for aion_engine-0.0.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 c9ab85b6e4875ea81a52e12b95740e9118387bd68ef1f6727a27f7347726208f
MD5 accf70584173011637d5ce8b1360fd4c
BLAKE2b-256 02d2eaf17fc526087e34a80f7457842f842b0f37bb9aeac5f547e03e566351f1

See more details on using hashes here.

Provenance

The following attestation bundles were made for aion_engine-0.0.2-cp312-cp312-win_amd64.whl:

Publisher: publish.yml on RubyBit/aion

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file aion_engine-0.0.2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for aion_engine-0.0.2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 9e73f568319bc96da39b6f249f8d9c68b9c3540ef6e02fd2bb8d8b9ac5983220
MD5 0f868f2c9b43319f2c8a2f33f350f2db
BLAKE2b-256 8fabcca1f2ebc50a9a07f058e70f4960110e2fe8a1d86b10e67804c049af6291

See more details on using hashes here.

Provenance

The following attestation bundles were made for aion_engine-0.0.2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl:

Publisher: publish.yml on RubyBit/aion

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file aion_engine-0.0.2-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl.

File metadata

File hashes

Hashes for aion_engine-0.0.2-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 8ee71e6e790a873e812ad0270f6c7f2fd3886ef85f479a94333c042d90a60071
MD5 9aec51101f0419b2a5722f4e798e4614
BLAKE2b-256 44020ee1afd2dcc6a1840f2627da43c2e8c49405804f99fe12893df7df23b7b9

See more details on using hashes here.

Provenance

The following attestation bundles were made for aion_engine-0.0.2-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl:

Publisher: publish.yml on RubyBit/aion

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file aion_engine-0.0.2-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for aion_engine-0.0.2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 27eb4eeade57eecfcfaacef608f069906a09bc45d45ac326eb570fe6db39366d
MD5 3801dd7703296ba0db7c75082827e043
BLAKE2b-256 fd7c9b7abef3a4cadb41cd0c7776b08b087c30163c3dad92958fa844c7b48adb

See more details on using hashes here.

Provenance

The following attestation bundles were made for aion_engine-0.0.2-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: publish.yml on RubyBit/aion

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.0.2 This release

8 files

0.0.1

8 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page