Repository navigation
Studio: bump mflux to 0.24.0 and decode Z-Image in strips instead of tiles - #18933
Merged
Merged
Conversation
…tiles mflux 0.24 decodes the Z-Image VAE block by block (mflux-community/mflux#910) and ignores TilingConfig for it, so Studio now sets the VAE's decode_mode: the whole image (full_precision, the untiled decode's pixels bit for bit) when it fits the free working set, else 128-row strips with whole-image GroupNorm statistics (low_memory, no tile seams). The decode estimate and the load headroom follow the mode that runs. mflux 0.24 requires Python 3.11, so a Python 3.10 venv keeps 0.22, and the engine accepts either release so a lagging pin still loads (0.22 keeps the TilingConfig path).
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
[skip ci]
Member
Author
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep it up! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
danielhanchen
added a commit
that referenced
this pull request
Nov 22, 2026
…, and read checked-in sources as UTF-8 (main reds) (#18952) ## Summary Two checks are red on `main` and fail on every PR that runs them, for example the staging run for #18941: | Failing check | Introduced by | Which side was wrong | Fix | |---|---|---|---| | `tests/studio/install/test_mlx_install.py::test_mlx_image_engine_pins_leave_the_mlx_stack_alone` (`studio-install` shard): `assert 'mflux==0.24.0'.startswith('mflux==0.22.')` | #18933 bumped mflux to 0.24.0 (0.22.0 kept for Python 3.10) | Test. The bump is intended. The test pinned a version literal of its own, so every mflux bump breaks it. | The test now checks the installer pin against the MLX engine itself: `_MLX_DIFFUSION_PINS` must be exactly `mflux==<MFLUX_VERSION>` for the running interpreter, and that version must be in `MFLUX_COMPATIBLE_VERSIONS`. Both are read from `mlx_diffusion_convert.py`'s source, since importing it needs numpy and the installer tests do not have it. The check is stricter than before: an installer pin that drifts from what the engine accepts at runtime now fails. | | `tests/test_source_read_encoding.py::test_checked_in_file_reads_name_an_encoding` (`rest-2` shard): 3 reads with the platform default encoding | #18923 (`tests/test_adapter_unc_base_guard.py:30` and `:91`) and `tests/test_inkling2_support.py:367` | Tests. On Windows a bare `read_text()` uses the locale code page. | `encoding = "utf-8"` on those three reads. | Only tests change. ## Testing - `tests/studio/install/test_mlx_install.py`, `tests/test_source_read_encoding.py`, `tests/test_adapter_unc_base_guard.py`, `tests/test_inkling2_support.py`: 3 failed on `main`. With this change, 92 passed, 4 skipped. - Sabotage: with `_MFLUX_PIN` changed to `mflux==0.23.0`, a version the engine does not expect, the mflux test fails with `assert 'mflux==0.23.0' == 'mflux==0.24.0'`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Bumps the opt-in MLX image engine from mflux 0.22.0 to 0.24.0, and makes Studio drive the new Z-Image VAE decode instead of the tiling that 0.24 now ignores.
mflux 0.24 (mflux-community/mflux#910) decodes the Z-Image VAE one block at a time and drops
TilingConfigfor it. With a plain pin bump, Studio would keep setting aTilingConfigthat does nothing, and its memory estimate would describe a decode that no longer runs. This PR sets the VAE'sdecode_modefor each generation instead:full_precisionwhen the whole-image decode fits in the free Metal working set. This is the default whenever the untiled decode used to fit, and its pixels are bit-identical to the 0.22 untiled decode.low_memoryeverywhere Studio used to tile: when the whole-image decode does not fit, when the media price already reserved the low-memory path, or whenUNSLOTH_DIFFUSION_MLX_VAE_TILING=1. It decodes in 128-row strips and takes GroupNorm statistics from the whole image, so there are no tile seams.UNSLOTH_DIFFUSION_MLX_VAE_TILING=0still forces the whole-image path. The load headroom and the fit check use measured peaks for each mode.Compatibility
_MFLUX_PY310_PIN).MFLUX_COMPATIBLE_VERSIONS). A lagging pin therefore keeps the engine: a 3.10 venv, or an update that could not reach PyPI. 0.22 keeps theTilingConfigpath, chosen by whether the loaded VAE has adecode_mode.pillow>=13, but only for its security advisories. It is installed--no-deps, and it imports and decodes on 12.3.0 (macos-15 runs below). 0.22 still breaks on 13.Evidence (macos-15 staging, Apple M1 (Virtual), mlx 0.32.4, Pillow 12.3.0)
VAE-only decode of saved Z-Image Turbo latents with the real VAE. One process per cell. Peak is
mx.get_peak_memory()above the weights. PSNR is measured against the 0.22 untiled decode.Where the decode fits, the output is unchanged and the peak is the same or lower. Where Studio used to tile, it now uses strips:
The 768 and 1024 tile decodes are below 40 dB, which is where the visible bands come from. The strips are not.
The whole-image peaks (legacy, tiles) swing by up to 1.5 GB between identical runs on this runner. The strip peaks repeat to within 0.04 GB. The 1024 legacy decode (7.5 GB on a 7 GB runner) also hung the virtual GPU (
kIOGPUCommandBufferCallbackErrorHang) on a repeat; the strip decode never did.Studio engine end to end, merge base (mflux 0.22) against this branch (mflux 0.24), same job:
UNSLOTH_DIFFUSION_MLX=1TilingConfig(one tile at 512)decode_mode=low_memory,tiling_config=NoneThe 512 head render sits 48.6 dB from base, which matches the VAE-only strip number (49.3 dB). At 768, most of the 42 dB gap is the base's tile error.
Tests
test_mlx_diffusion_backend.py: the 0.24decode_modeplan (full image or strips, the env override, the priced path,tiling_configcleared), the strip and whole-image estimates against the Metal measurements, and the headroom with strips forced off.test_diffusion_mlx_engine_router.py: either supported mflux selects MLX, an unsupported one (0.17, 0.23, none) falls back, and the installer pins matchMFLUX_VERSIONfor this Python.test_diffusion_device.py). On macos-15, with real mlx and mflux and each arm on its own tree, head (mflux 0.24) gives 441 passed and 1 skipped, and base (mflux 0.22) gives 428 passed and 1 skipped.Not tested
In the first engine run, the head arm went first and hit a Metal
GPU Timeout Errorwhile materializing the weights at load (mx.evalinbuild, unchanged by this PR). The runner had a 4.67 GiB working set against a 7.85 GiB plan. With the order swapped, both arms passed. I could not confirm the cause beyond that.Both arms segfault (exit 139) at interpreter exit after the last check passed. This is the same in base and head.
Real Apple GPUs other than the virtual M1. Timings here are relative only.
Python 3.10 on Mac (the 0.22 fallback pin) end to end. Only the selection logic is unit tested.