Skip to main content

MLX AutoQuant

CI

mlx-autoquant converts a Hugging Face Transformers checkpoint to MLX, choosing the highest quantization precision that safely fits the current Apple-silicon Mac.

It reads your unified-memory capacity, profiles config.json and Hugging Face safetensors metadata, reserves memory for macOS and a KV cache, then calls the maintained mlx_lm.convert API.

Install

Install the released package from PyPI:

pip install mlx-autoquant

For local development:

python3 -m venv .venv
source .venv/bin/activate
pip install -e .

Use

Preview the decision without downloading weights. The context default is read from the model config and capped at 8192 tokens; pass --context-length to override it:

mlx-autoquant Qwen/Qwen2.5-7B-Instruct --dry-run
mlx-autoquant Qwen/Qwen2.5-7B-Instruct --dry-run --context-length 16384

Convert using the automatic decision:

mlx-autoquant Qwen/Qwen2.5-7B-Instruct --output ./Qwen2.5-7B-MLX

Use a larger expected context window, or take responsibility for a fixed precision:

mlx-autoquant Qwen/Qwen2.5-7B-Instruct --context-length 16384
mlx-autoquant Qwen/Qwen2.5-7B-Instruct --bits 4 --output ./Qwen-4bit

Add --json for machine-readable output. It includes every tested bit-width and whether it fits:

mlx-autoquant Qwen/Qwen2.5-7B-Instruct --dry-run --json

Conversions run an 8-token generation smoke test after quantization. Use --no-verify to skip it, or --verify-tokens 16 to generate more tokens.

Each completed conversion writes autoquant-report.json next to the MLX model. It records the detected machine, the model dimensions, the selected bits, and the memory assumptions. Parameter counts come from Hugging Face's safetensors metadata; when a repository has no safetensors weights, the tool falls back to an estimate from config.json and labels it as such.

Errors are printed to stderr with a non-zero exit code instead of a traceback. Downloads are cached under ~/.cache/mlx-autoquant; set HF_HOME to move the Hugging Face cache, and HF_TOKEN to authenticate private or gated models.

During a real conversion you get two progress indicators: an aggregate bar while the weights download, then an activity bar while the model is quantized. The verification result and peak MLX memory are written to autoquant-report.json.

Design boundaries

  • Apple silicon only: MLX does not run on other hardware.
  • Supports standard Transformers checkpoints with config.json; remote code is opt-in.
  • A 15% conversion/sharding allowance and a 25% (minimum 4 GiB) system reserve make the automatic choice conservative.
  • The user can always choose --bits, but the command intentionally displays the resulting plan first.
  • Without safetensors weights, parameter counts are estimates; the report and summary mark them as estimated.

Development

python3 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
ruff check src tests          # lint
ruff format --check src tests # format
mypy src/mlx_autoquant        # type check
pytest                        # tests
make coverage                 # test coverage

Download files

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

Source Distribution

mlx_autoquant-0.2.0.tar.gz (15.4 kB view details)

Uploaded Source

Built Distribution

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

mlx_autoquant-0.2.0-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

Details for the file mlx_autoquant-0.2.0.tar.gz.

File metadata

  • Download URL: mlx_autoquant-0.2.0.tar.gz
  • Upload date:
  • Size: 15.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for mlx_autoquant-0.2.0.tar.gz
Algorithm Hash digest
SHA256 e57420398d24ad5ed60b94dd22ef74b4c571791e74819974a2b50de5cba4c07b
MD5 f2cbed9409f421ffb897292a0e9f3d61
BLAKE2b-256 de6646bd90a67c22b6649bb6609ad7b7580db3b0d4b4bd6a98a41ae46efebf5e

See more details on using hashes here.

Provenance

The following attestation bundles were made for mlx_autoquant-0.2.0.tar.gz:

Publisher: release.yml on asmit404/mlx-autoquant

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

File details

Details for the file mlx_autoquant-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: mlx_autoquant-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 12.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for mlx_autoquant-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0d7fee7cef59470483fd4df51e106c6e26484c4b18bc7aadd9de25dd951624d9
MD5 c964138feff3a927320a8f69798d5a3f
BLAKE2b-256 77d934fdaff6e64ae8857b156ea58f10ec40beedc5418eec8f5412ba43671496

See more details on using hashes here.

Provenance

The following attestation bundles were made for mlx_autoquant-0.2.0-py3-none-any.whl:

Publisher: release.yml on asmit404/mlx-autoquant

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

Supported by

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