mflux-CV
A drop-in community build of mflux by Filip Strand (MIT). It
stays current with upstream main and adds a curated set of fixes, training features, and useful
community PRs, with prebuilt wheels on GitHub Releases so improvements are easy to pick up between
upstream releases. The Python package is still mflux and every CLI keeps its name,
so this is a direct replacement in ComfyUI, image-studio, or any existing setup.
Install
pip install mflux-cv
To track a specific tag instead, or to pick up work that has not been released yet:
pip install git+https://github.com/HowDidTheCatGetSoFat/mflux-cv.git@v.0.18.25-CV
Wheels are also attached to every Release.
Install this or upstream
mflux, never both. The distribution is namedmflux-cvso it can live on PyPI alongside upstream, though both provide the samemfluximport package. With both installed, pip raises no error while the two overwrite each other's files, and uninstalling either one leaves the other broken. Runpip uninstall mfluxbefore installing this, andpip uninstall mflux-cvbefore going back.
Relationship to upstream: kept rebased on filipstrand/mflux so changes merge back cleanly. Every
upstream commit is included and nothing is removed. Credit for the base project and every pulled PR
goes to their authors.
Changelog (on top of upstream 0.18.0)
0.18.26-CV
-
Z-Image Turbo Union ControlNet, native in MLX. The first Z-Image ControlNet running in MLX, with all five modalities computed locally (no pre-made control image needed):
mflux-generate-z-image-controlnet \ --control canny:room.png:1.0 --controlnet-strength 0.6 \ --prompt "a cozy bedroom, photorealistic" --steps 8 --output out.png
--control type:path[:strength]is repeatable to stack controls. Types:canny,mlsd,depth,hed,pose. -
Preprocessors:
cannyandmlsdvia OpenCV,depthvia the native DepthPro mflux already ships, and nativemlx.nnports ofhed(ControlNetHED) andpose(OpenPose body). Only weight loading touches torch; every forward pass is MLX. -
The controlnet inference is numerically matched to the diffusers
ZImageControlNetModel(block-by-block residual cosine 1.00000). A correctness fix carries the refined control tokens into the main control layers, which the original port dropped.
0.18.25-CV
-
Multi-ControlNet for FLUX.1. Several controlnets can now be stacked, each with its own checkpoint, control image and strength (for example depth + canny). Repeat
--controlnet-pathand--controlnet-image-path(and optionally--controlnet-strength, or give one value for all):mflux-generate-controlnet -m dev --prompt "a modern living room" \ --controlnet-path org/depth --controlnet-image-path depth.png --controlnet-strength 0.7 \ --controlnet-path org/canny --controlnet-image-path canny.png --controlnet-strength 0.4
The residual path is additive, so each net's residuals are spread over the transformer's blocks with the rule the transformer already applies and then summed. Controlnets with different block counts stack correctly, and a single controlnet renders exactly as before (the expansion reproduces the transformer's own selection index for index, which is pinned by a test).
-
--controlnet-pathis new: it selects a controlnet checkpoint (local path or HF repo) instead of the one named by the model config, which also makesFlux1Controlnet(controlnet_path=...)work. It was previously accepted by the constructor and silently ignored. -
A single
--controlnet-image-path/--controlnet-strengthkeeps its scalar shape, so existing commands and the metadata round-trip are unchanged. -
Canny preprocessing is decided per controlnet, from that net's own checkpoint name (the same match
is_canny()makes). A depth + canny stack therefore preprocesses only the canny image, and a config-driven canny run behaves exactly as before. -
Known limitation: the image metadata holds a single controlnet, so a stacked run records only its first net there. Metadata-driven re-runs of a stack are not supported; pass the flags explicitly. Single-controlnet metadata is unchanged.
0.18.24-CV
- FLUX.2-klein now exposes
flux2-klein-edit/flux2-edit/klein-editaliases (it does txt2img and edit from the same weights), so the edit variant is selectable by name — used by the ComfyUI-mflux-AnyModel node. - Qwen-Image-Edit: skip the unconditional pass at guidance 1.0 (it reduces to the conditional noise there), halving per-step compute for CFG-distilled setups like the Lightning step-reduction LoRAs.
0.18.23-CV
- Updated the default Qwen models to the latest releases (based on #475's sibling, #474, credited
under Community PRs pulled in):
qwen-imagenow loads Qwen-Image-2512 andqwen-image-editloads Qwen-Image-Edit-2511. The architecture is identical to the prior releases, so they are drop-in; both were validated end-to-end on Apple Silicon. Unlike the upstream PR, the oldqwen-edit-2509alias still resolves to the actual 2509 weights (kept as its own entry) instead of silently pointing at the new default.
0.18.22-CV
- Pulled in configurable VAE decode tiling (#475, credited under Community PRs pulled in):
--vae-tiling/--vae-tile-sizedecouple tiled decoding from full low-RAM mode, so you can cut peak memory on large generations without the rest of the low-RAM penalty.
0.18.21-CV
- Krea 2 depth ControlNet: fix the estimated-depth convention (Depth Pro already outputs near = white,
like Depth-Anything-V2, so its map is now used un-inverted — an earlier inversion put the background in
front).
--save-depth-mapnow writes the estimated map (<output>_depth_map.png).
0.18.20-CV
- Krea 2 depth ControlNet now supports quantization (
-q 8/-q 4): the control deltas are baked into the base weights before quantization, so the packed model keeps the depth control. Validated end-to-end at int8.
0.18.19-CV
- New: Krea 2 depth ControlNet (
mflux-generate-krea2-controlnet). Runs the community Krea-2-controlnet depth checkpoint natively in MLX: the input projection is widened to take a depth latent concatenated on the channel axis, and the attention/MLP deltas are merged into the base weights. Depth is taken from a supplied map (--depth-image-path) or estimated with the native Depth Pro. See the Krea 2 depth ControlNet section below.
0.18.18-CV
- Pulled in two new upstream models (credited under Community PRs pulled in):
Boogu-Image-0.1-Turbo (#446,
mflux-generate-boogu) and Qwen-Image-Layered (#302,mflux-generate-qwen-layered) for decomposing an image into RGBA layers.
0.18.17-CV
- Pulled in Ideogram 4 mlx-forge checkpoint loading (#445) and mixed-quant FLUX.2 inference (#436), both credited under Community PRs pulled in.
0.18.16-CV
- Pulled in two upstream bug fixes (credited under Community PRs pulled in): fused-qkv LoRA loading (#459) and ERNIE / Krea 2 tiled img2img (#463).
- Repo automation: CodeQL security scanning, structured issue forms, and PR / issue auto-labeling.
0.18.15-CV
First release under the mflux-CV name, in the community home at
HowDidTheCatGetSoFat/mflux-cv. Same codebase as the
prior +fxd0h builds (0.18.1 through 0.18.5); this is the rebrand plus everything listed below.
0.18.5
- Krea 2
--krea2-uncensor <k>: scales the text-fusion projector's refusal layers (tapped Qwen3-VL 9/10/11) so explicit prompts render instead of being dodged.k=1is off,~6neutralises the filter.
0.18.4
- LoRA on quantized bases: keep the adapter live at inference instead of baking it into the quantized
weights (baking re-quantized and badly diverged the output on the
--quantizedefault). - LoKr: load LyCORIS LoKr adapters for Krea 2, Qwen, and Ideogram 4.
- Ideogram 4: fix the stepwise-preview VAE decode crash on already-unpacked latents; guard the
injected-LoRA scan against transformers without
named_modules. - Krea 2 Raw: download the diffusers transformer from HuggingFace.
- z-image: shared
--saveinfofilename builder; fix numeric-tag collisions. - qwen-edit: clearer error on empty
image_paths; regenerated golden references.
0.18.3
- Review fixes: fp8-aware fused DoRA, training guards (LR, grad-accum reset on skip, qwen VAE flag), route the CFG negative through an injected LoRA in training previews, surface LoRA bake failures on save, EMA resume from live weights.
0.18.2
- Krea 2 sigma schedule: use the official dynamic exponential shift instead of a linear 1.15.
0.18.1
- Training suite: DoRA (weight-decomposed LoRA) for Krea 2, Ideogram 4, z-image, flux, flux2; gradient accumulation; EMA of trained weights; caption dropout; masked loss; regularization / prior-preservation images; continue training from an existing LoRA; non-finite-step guard; utf-8-safe captions; free training-loss plot.
- Krea 2: LoRA training, Raw variant, and diffusers-format loading.
Community PRs pulled in
- filipstrand/mflux#459 by Sahil Tanveer — fix LoRA loading for fused qkv layers: keep the shared rank/down projection whole and slice only the up projection, so kohya/BFL FLUX LoRAs with a rank divisible by 3/4 load correctly.
- filipstrand/mflux#463 by Mike Wallio — fix ERNIE and Krea 2 img2img with tiled VAE latents: the 5D tiled-VAE pack path took the wrong slice; keep the singleton temporal axis so tiled-decode img2img reconstructs correctly.
- filipstrand/mflux#445 by plz12345 — load Ideogram 4 from mlx-forge converted checkpoints (bf16 / int8) by HF repo id, skipping the fp8-only validation; plus a once-built boolean attention keep-mask. Merged with our gradient-checkpointing.
- filipstrand/mflux#436 by Ian Scrivener — mixed-quant
inference for FLUX.2: quantize the transformer and text encoder to different levels, or load each from
its own path (
--model-transformer/--model-text-encoder); the VAE stays bf16. Merged alongside our LoKr flux2 changes. - filipstrand/mflux#446 by plz12345 — new model:
Boogu-Image-0.1-Turbo (
mflux-generate-boogu). Applied cleanly. - filipstrand/mflux#302 by ZimengXiong — new model:
Qwen-Image-Layered (
mflux-generate-qwen-layered) for decomposing an image into RGBA layers, with a low-memory chunked save path. We kept our README; the PR's stale old-structure README changes were dropped. - filipstrand/mflux#475 by azrahello — configurable
VAE decode tiling:
--vae-tilingand--vae-tile-size(min 128, multiple of 16) enable tiled decoding on its own, decoupled from--low-ram, to lower peak memory during the VAE decode phase. Applied cleanly. - filipstrand/mflux#474 by imbible — bump the default
Qwen models to Qwen-Image-2512 and Qwen-Image-Edit-2511. Both validated generating end-to-end on Apple
Silicon (identical architecture, drop-in). We diverged in one place: kept a separate
qwen-image-edit-2509entry soqwen-edit-2509still resolves to the real 2509 weights instead of the new default.
Krea 2 depth ControlNet
Steer a Krea 2 generation with the depth of a reference image, running natively in MLX. Uses the
community Krea-2-controlnet depth checkpoint by
Tanmay Patil (base weights: krea/Krea-2-Raw / krea/Krea-2-Turbo).
mflux-generate-krea2-controlnet \
--model krea2 \
--controlnet-path /path/to/depth-control-lora.safetensors \
--image-path reference.png \
--prompt "a glowing crystal orb on a wooden table, studio photo" \
--steps 8 --seed 42 --height 1024 --width 1024 \
--output out.png
--image-pathestimates depth with the native Depth Pro (near = white, used as-is, the same convention the checkpoint was trained on). Add--save-depth-mapto also write the estimated map. For the closest match to the training data, pass a Depth-Anything-V2 map directly with--depth-image-path.--controlnet-strengthscales how strongly the control deltas are merged (default1.0).--krea2-uncensoris supported here too.-q 8/-q 4quantize the variant: the control deltas are baked into the base weights before quantization, so the packed model keeps the depth control.
The rest of this file is the upstream mflux documentation.
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
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 | Fast, small, very good quality and realism. |
| Krea 2 | Jun 2026 | 12B | Turbo (distilled) | No | Very good quality with a wide range of styles; good for creative exploration. |
| FLUX.2 | Jan 2026 | 4B & 9B | Distilled & Base | Yes | Fastest + smallest with very good qaility and edit capabilities. |
| Ideogram 4 | Jun 2026 | 9B | Base | No | JSON-caption-native, typography-focused text-to-image generation. |
| ERNIE-Image | Apr 2026 | 8B | Distilled & Base | No | Single-stream DiT from Baidu. Vivid, high-contrast output. |
| FIBO | Oct 2025+ | 8B | Distilled & Base | No | Very good JSON-based prompt understanding. Has edit capabilities. |
| SeedVR2 | Jun 2025 | 3B & 7B | — | 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), including LyCORIS LoKr on FLUX.1 and FLUX.2
- 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.
🌱 Related projects
- MindCraft Studio — macOS app built on mflux by @shaoju
- Mflux-ComfyUI by @raysers
- MFLUX-WEBUI by @CharafChnioune
- mflux-fasthtml by @anthonywu
- mflux-streamlit by @elitexp
- mlx-taef — TAESD/TAEF tiny-autoencoder live previews and low-memory FLUX decode for mflux, by @IonDen
- mlx-teacache — TeaCache step-skipping to speed up FLUX generation in mflux, by @IonDen
🙏 Acknowledgements
MFLUX would not be possible without the great work of:
- The MLX Team for MLX and MLX examples
- Black Forest Labs for the FLUX project
- Bria for the FIBO project
- Tongyi Lab for the Z-Image project
- Baidu for the ERNIE-Image project
- Ideogram for the Ideogram 4 project
- Krea.ai for the Krea 2 project
- Qwen Team for the Qwen Image project
- ByteDance, @numz and @adrientoupet for the SeedVR2 project
- Hugging Face for the Diffusers library implementations
- Depth Pro authors for the Depth Pro model
- The MLX community and all contributors and testers
⚖️ License
This project is licensed under the MIT License.
Metadata
Release files for mflux-cv 0.18.26
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 | Actions |
|---|---|---|---|---|
| mflux_cv-0.18.26.tar.gz | 936.8 kB | Without provenance | Details for mflux_cv-0.18.26.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mflux_cv-0.18.26-py3-none-any.whl | Python 3 | none | any | Details for mflux_cv-0.18.26-py3-none-any.whl |
Total release size: 2.2 MB
Release files / mflux_cv-0.18.26.tar.gz
| Download URL | mflux_cv-0.18.26.tar.gz |
|---|---|
| Size | 936.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4b7e11bdb014f33c63e42ff5cfb5a193f34c30e973ad7b2616c72d0d57c802ff
|
|
BLAKE2b-256 checksum How to use checksums |
1ae4d28b013f407b5e9c6a12db14a00d5cbcad3ad42c866ba60e1bcdcfe084b7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.31 {"installer":{"name":"uv","version":"0.11.31","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}
|
Release files / mflux_cv-0.18.26-py3-none-any.whl
| Download URL | mflux_cv-0.18.26-py3-none-any.whl |
|---|---|
| Size | 1.3 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6ee9cb030f9a4e7bfb77cf7ed2f542b26fbc3848b917f12e764ffff17eaa8aec
|
|
BLAKE2b-256 checksum How to use checksums |
f21fc88dd91dce46e3f8cf250b722778b259c0ab211136c3fc3ef90b8bed47f9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.31 {"installer":{"name":"uv","version":"0.11.31","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}
|
Security for mflux-cv 0.18.26
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.