gamemlx
GAME — MLX edition. Pure MLX inference for GAME (Guided Automatic MIDI Extraction): singing vocals → MIDI, running natively on Apple Silicon GPU.
- Numerically aligned with the official PyTorch implementation: on a 20-file test set,
fp32 output matches torch CPU exactly — all onset/offset/pitch diffs
0.0000(docs/ALIGNMENT.md) - ~9× faster than torch CPU on M4 Air (0.172s vs 1.609s per file average), ~15–20× realtime
- Low memory: 111MB wired (fp16) / 206MB (fp32) on the medium model
- Automatic silence slicing → per-chunk inference → timeline-merged MIDI output (same behavior as upstream)
- Models auto-download from HuggingFace (ModelScope fallback)
Install
pip install gamemlx # or: uv tool install gamemlx
Requires Apple Silicon (M1–M4) and Python ≥ 3.10.
Quick start
# alias auto-downloads weights (small | medium | large) on first use
gamemlx extract vocals.wav -m medium --language zh
# local model dir + options
gamemlx extract song/ -m ./weights/GAME-1.0-medium-mlx \
--precision fp16 --language zh --tempo 120 \
--seg-threshold 0.2 --seg-radius 0.02 --est-threshold 0.2 \
--output-dir out/
Python API:
import gamemlx
model, lang_map = gamemlx.load_model("medium") # → GAMEModel + {"en":1,"ja":2,"yue":3,"zh":4}
gamemlx.extract(model, "vocals.wav", language="zh") # writes .mid next to the input
Supported languages: en, ja, yue, zh (improves segmentation; omit for language-agnostic).
Models
| alias | params | HF repo | also on ModelScope |
|---|---|---|---|
small |
12.7M | baicai1145/GAME-MLX-small | ✓ |
medium |
49.9M | baicai1145/GAME-MLX-medium | ✓ |
large |
99.0M | baicai1145/GAME-MLX-large | ✓ |
Converted from openvpi/GAME v1.0 checkpoints
(scripts/convert_to_mlx.py). Cache: ~/.cache/gamemlx (override with GAMEMLX_CACHE).
Precision & performance
| mode | notes |
|---|---|
fp32 (default) |
bit-aligned with torch reference on the test set |
fp16 |
same speed on Apple GPUs (no tensor cores), half the memory — use for large on 8GB machines |
Apple Silicon GPUs execute fp16 and fp32 at the same rate; fp16's benefit here is memory, not speed.
Speed optimizations (operator fusion via mx.compile, fused QKV, mask fast paths) are on by
default — disable with GAMEMLX_OPT=0 for the bit-exact eager path. Details:
docs/OPTIMIZATIONS.md, docs/BENCH.md.
Development
uv venv && uv pip install -e . mlx numpy librosa soundfile mido pyyaml safetensors huggingface_hub click
# convert weights from a GAME torch checkpoint
python scripts/convert_to_mlx.py --input /path/to/GAME-1.0-medium/model.pt --output weights/GAME-1.0-medium-mlx
# alignment test vs torch CPU (needs GAME repo + torch installed; see script headers for env vars)
python scripts/compare.py
python scripts/bench.py
Credits
- openvpi/GAME — the original model, training code and pretrained checkpoints (MIT). This project is an independent MLX inference port.
- Model weights follow the upstream license; conversion script included in this repo.
License
MIT — see LICENSE.
Metadata
Release files for gamemlx 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| gamemlx-0.2.1.tar.gz | 37.3 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| gamemlx-0.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 68.2 kB
Release files / gamemlx-0.2.1.tar.gz
| Download URL | gamemlx-0.2.1.tar.gz |
|---|---|
| Size | 37.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d27a707c0c8baf71e7394cad97e1c29f3d07210aab5e882313f1332a9027acee
|
|
BLAKE2b-256 checksum How to use checksums |
5f1bc32d3780a5147edc40928b3b27746c83cba52c2a95272086ff6c920ecc81
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / gamemlx-0.2.1-py3-none-any.whl
| Download URL | gamemlx-0.2.1-py3-none-any.whl |
|---|---|
| Size | 30.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
84db5cf42b1f6c4b169c685a7e1a4bdcfed79711b6d38627f78873c1220a35e9
|
|
BLAKE2b-256 checksum How to use checksums |
d345eb1ee8564f7d7fc7fc590bed9f18d4379a3d4063309b15b6e39d17b0a116
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Security for gamemlx 0.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.