Skip to main content

MLX native implementations of state-of-the-art generative image models.

Project description

image

MFLUX MLX CI

About

Run the latest state-of-the-art generative image models locally on your Mac in native MLX!

Table of contents


💡 Philosophy

MFLUX is a line-by-line MLX port of several state-of-the-art generative image models from the Huggingface Diffusers and Huggingface Transformers libraries. All models are implemented from scratch in MLX, using only tokenizers from the Huggingface Transformers library. MFLUX is purposefully kept minimal and explicit, @karpathy style.


💿 Installation

If you haven't already, install uv, then run:

uv tool install --upgrade mflux

After installation, the following command shows all available MFLUX CLI commands:

uv tool list 

To generate your first image using, for example, the z-image-turbo model, run

mflux-generate-z-image-turbo \
  --prompt "A puffin standing on a cliff" \
  --width 1280 \
  --height 500 \
  --seed 42 \
  --steps 9 \
  -q 8

Puffin

The first time you run this, the model will automatically download which can take some time. See the model section for the different options and features, and the common README for shared CLI patterns and examples.

Python API

Create a standalone generate.py script with inline uv dependencies:

#!/usr/bin/env -S uv run --script
# /// script
# requires-python = ">=3.10"
# dependencies = [
#   "mflux",
# ]
# ///
from mflux.models.z_image import ZImageTurbo

model = ZImageTurbo(quantize=8)
image = model.generate_image(
    prompt="A puffin standing on a cliff",
    seed=42,
    num_inference_steps=9,
    width=1280,
    height=500,
)
image.save("puffin.png")

Run it with:

uv run generate.py

For more Python API inspiration, look at the CLI entry points for the respective models.

⚠️ Troubleshooting: hf_transfer error

If you encounter a ValueError: Fast download using 'hf_transfer' is enabled (HF_HUB_ENABLE_HF_TRANSFER=1) but 'hf_transfer' package is not available, you can install MFLUX with the hf_transfer package included:

uv tool install --upgrade mflux --with hf_transfer

This will enable faster model downloads from Hugging Face.

DGX / NVIDIA (uv tool install)
uv tool install --python 3.13 mflux

🎨 Models

MFLUX supports the following model families. They have different strengths and weaknesses; see each model’s README for full usage details.

Model Release date Size Type Training Description
Z-Image Nov 2025 6B Distilled & Base Yes Best all-rounder: fast, small, very good quality and realism.
FLUX.2 Jan 2026 4B & 9B Distilled & Base Yes Fastest + smallest with very good qaility and edit capabilities.
FIBO Oct 2025 8B Base No Very good JSON-based prompt understanding and editability, medium speed
SeedVR2 Jun 2025 3B No Best upscaling model.
Qwen Image Aug 2025+ 20B Base No Large model (slower); strong prompt understanding and world knowledge. Has edit capabilities
Depth Pro Oct 2024 No Very fast and accurate depth estimation model from Apple.
FLUX.1 Aug 2024 12B Distilled & Base No (legacy) Legacy option with decent quality. Has edit capabilities with 'Kontext' model and upscaling support via ControlNet

✨ Features

General

  • Quantization and local model loading
  • LoRA support (multi-LoRA, scales, library lookup)
  • Metadata export + reuse, plus prompt file support

Model-specific highlights

  • Text-to-image and image-to-image generation.
  • LoRA finetuning
  • In-context editing, multi-image editing, and virtual try-on
  • ControlNet (Canny), depth conditioning, fill/inpainting, and Redux
  • Upscaling (SeedVR2 and Flux ControlNet)
  • Depth map extraction and FIBO prompt tooling (VLM inspire/refine)

See the common README for detailed usage and examples, and use the model section above to browse specific models and capabilities.

[!NOTE] As MFLUX supports a wide variety of CLI tools and options, the easiest way to navigate the CLI in 2026 is to use a coding agent (like Cursor, Claude Code, or similar). Ask questions like: “Can you help me generate an image using z-image?”


🌱 Related projects


🙏 Acknowledgements

MFLUX would not be possible without the great work of:


⚖️ License

This project is licensed under the MIT License.

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

mflux-0.16.1.tar.gz (760.8 kB view details)

Uploaded Source

Built Distribution

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

mflux-0.16.1-py3-none-any.whl (1.0 MB view details)

Uploaded Python 3

File details

Details for the file mflux-0.16.1.tar.gz.

File metadata

  • Download URL: mflux-0.16.1.tar.gz
  • Upload date:
  • Size: 760.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.19

File hashes

Hashes for mflux-0.16.1.tar.gz
Algorithm Hash digest
SHA256 586b881fb06b2b8a313d5c459565c76d515c431e79033c11aa927d82e80fd23d
MD5 bb14999a994c5d02b05eced4c802352f
BLAKE2b-256 3b39c337bf598efe08b4f1101e0bf1f6407f44cdaef31e705133691c434e67de

See more details on using hashes here.

File details

Details for the file mflux-0.16.1-py3-none-any.whl.

File metadata

  • Download URL: mflux-0.16.1-py3-none-any.whl
  • Upload date:
  • Size: 1.0 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.19

File hashes

Hashes for mflux-0.16.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8caefb5b5d81f795450cf8fb56b7c4ab51bde0b41c7b6a4c99a94fbce05f7e6e
MD5 42f5d10c6d8cc31f630c3657155692ee
BLAKE2b-256 98f43e56564c3dab560727ba6655f08667742370de23ec40ceccf83dde1af6a2

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