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, downloads only config.json and model.safetensors.index.json to profile the model, reserves memory for macOS and a KV cache, then calls the maintained mlx_lm.convert API. MLX-LM is responsible for downloading and converting the full checkpoint.

Install

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

Use

Preview the decision without downloading weights:

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

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 (progress bars are suppressed during downloads):

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

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.

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

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.1.0.tar.gz (12.8 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.1.0-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mlx_autoquant-0.1.0.tar.gz
  • Upload date:
  • Size: 12.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.6

File hashes

Hashes for mlx_autoquant-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6baeca5b83de738719fef9a527d29cc4ca88164b50eef20d45b3ed84d566d911
MD5 5f1dac438af29d0920d21034632fc6d9
BLAKE2b-256 c54495e4c104528922ff0aeba63347d2444a037842b14e4dc7946bc4d6aba153

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mlx_autoquant-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.6

File hashes

Hashes for mlx_autoquant-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ac68abc75d12690d8d94deabad002d2454056ad15ffbc72847141fe3d15d7ed2
MD5 2333c52385f0259f1225e39c9d57103d
BLAKE2b-256 4d196b97220599c4fb426e6c5c56f7a9ef4ae48a83e5bf9f09fb6f654a762c70

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 Sentry Error logging StatusPage Status page