MLX Python port of Percepta's transformer-vm
Project description
mlx-transformer-vm
mlx-transformer-vm is a standalone Python port of Percepta's
transformer-vm with the
compiler stack kept in Python and the eventual model runtime targeted at MLX.
The current focus is semantic parity for the computation graph, exact evaluator, and WASM machine construction.
Status
Ported now:
- graph DSL in
mlx_transformer_vm/graph/core.py - exact graph evaluator in
mlx_transformer_vm/evaluator.py - WASM machine graph builder in
mlx_transformer_vm/wasm/interpreter.py - reference WASM interpreter in
mlx_transformer_vm/wasm/reference.py - deterministic scheduler in
mlx_transformer_vm/scheduler/deterministic.py - MILP scheduler in
mlx_transformer_vm/scheduler/milp.py - MLX standard-cache runtime skeleton in
mlx_transformer_vm/model/transformer.pyandmlx_transformer_vm/attention/standard_cache.py - hull KV cache bridge in
mlx_transformer_vm/attention/hull_cache.py - analytical weight construction in
mlx_transformer_vm/model/weights.py - local parity harness in
mlx_transformer_vm/parity.py, compiling vendored examples and optionally checking the upstream weighted runtime as an oracle - local compiler fixtures in
examples/hello.c,examples/addition.c,examples/collatz.c, andexamples/fibonacci.c - CLI parity for
wasm-build,wasm-run,wasm-compile, andwasm-specialize
Upstream Mapping
The port stays structurally close to upstream:
| Upstream | This repo |
|---|---|
transformer_vm/graph/core.py |
mlx_transformer_vm/graph/core.py |
transformer_vm/evaluator.py |
mlx_transformer_vm/evaluator.py |
transformer_vm/wasm/interpreter.py |
mlx_transformer_vm/wasm/interpreter.py |
transformer_vm/wasm/reference.py |
mlx_transformer_vm/wasm/reference.py |
transformer_vm/model/weights.py |
mlx_transformer_vm/model/weights.py |
transformer_vm/model/transformer.py |
mlx_transformer_vm/model/transformer.py |
transformer_vm/scheduler/milp.py |
mlx_transformer_vm/scheduler/milp.py |
transformer_vm/compilation/* |
mlx_transformer_vm/compilation/ |
Development
Install dependencies:
uv sync --extra dev
Run the fast unit tests:
uv run pytest mlx_transformer_vm/tests/test_graph_core.py
Run the parity tests against the vendored local examples:
uv run pytest mlx_transformer_vm/tests/test_parity.py
Run the evaluator on a compiled token program:
uv run wasm-eval-mlx /path/to/program.txt
Diff this port against the local examples:
uv run tvm-mlx-parity --examples hello addition collatz fibonacci
Enable the optional upstream weighted oracle explicitly:
uv run tvm-mlx-parity --weighted --examples hello addition collatz fibonacci
The upstream repository is optional and is only used for the weighted-oracle
comparison path in mlx_transformer_vm/parity.py.
Set TRANSFORMER_VM_UPSTREAM_ROOT to enable that path.
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 Distribution
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 mlx_transformer_vm-0.2.0.tar.gz.
File metadata
- Download URL: mlx_transformer_vm-0.2.0.tar.gz
- Upload date:
- Size: 79.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ca79e1b05cf3d7a479d072422546ac804d6251d4748480afec2e22733eea6b7e
|
|
| MD5 |
bc3282b971195d91648f5a1fae149520
|
|
| BLAKE2b-256 |
7b27276d72c432e85e4b8f450172139e12281a0442568c1012b46ec3c23216da
|
File details
Details for the file mlx_transformer_vm-0.2.0-py3-none-any.whl.
File metadata
- Download URL: mlx_transformer_vm-0.2.0-py3-none-any.whl
- Upload date:
- Size: 93.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4260e29ca4bd30ae09482966209026c14f32fe937f2751098a77277fc0d0c13b
|
|
| MD5 |
e553df9d8ed13a713d0a93f00baed896
|
|
| BLAKE2b-256 |
fd08314e8ad120e1a27f9431ac7d627c55dfdb23a772ec2b8fda29aeebb58cc6
|