Skip to main content

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:

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


Download files

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

Source Distribution

mlx_transformer_vm-0.2.0.tar.gz (79.5 kB view details)

Uploaded Source

Built Distribution

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

mlx_transformer_vm-0.2.0-py3-none-any.whl (93.1 kB view details)

Uploaded Python 3

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

Hashes for mlx_transformer_vm-0.2.0.tar.gz
Algorithm Hash digest
SHA256 ca79e1b05cf3d7a479d072422546ac804d6251d4748480afec2e22733eea6b7e
MD5 bc3282b971195d91648f5a1fae149520
BLAKE2b-256 7b27276d72c432e85e4b8f450172139e12281a0442568c1012b46ec3c23216da

See more details on using hashes here.

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

Hashes for mlx_transformer_vm-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4260e29ca4bd30ae09482966209026c14f32fe937f2751098a77277fc0d0c13b
MD5 e553df9d8ed13a713d0a93f00baed896
BLAKE2b-256 fd08314e8ad120e1a27f9431ac7d627c55dfdb23a772ec2b8fda29aeebb58cc6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page