Skip to content

Hide MLX-only variants on non-Apple platforms#21

Merged
cryptopoly merged 1 commit intomainfrom
fix/hide-mlx-on-non-apple
May 1, 2026
Merged

Hide MLX-only variants on non-Apple platforms#21
cryptopoly merged 1 commit intomainfrom
fix/hide-mlx-on-non-apple

Conversation

@cryptopoly
Copy link
Copy Markdown
Owner

Summary

  • Adds backend_service/helpers/platform_filter.py with is_apple_silicon(), is_mlx_only_variant(), and filter_mlx_only_families().
  • Wires the filter into _image_model_payloads and _video_model_payloads so the /api/images/catalog and /api/video/catalog responses drop MLX-only variants on Linux / Windows.
  • Drops MLX-only families entirely when their full variant set is Apple-only (e.g. the LTX-2 (MLX) family disappears on Windows rather than rendering an empty card).
  • Covers the helper with 15 unit tests in tests/test_platform_filter.py — pinned platform values keep the suite reliable on any host.

Why

Surfaced by the v0.7.2 smoke test on a Windows / RTX 4090 box. The Image Studio dropdown showed FLUX.1 Dev · mflux (MLX) alongside the GGUF variants; Video Studio showed the four prince-canuma/LTX-2-* MLX entries. Both routes depend on mlx, which has no Linux or Windows wheels — picking either failed at preload time.

Filtering is server-side so no frontend code changes are needed and the dropdowns stay honest with whatever the catalog ships.

Detection

A variant is treated as MLX-only iff one of the following is true:

  • mlxOnly: True (explicit override for future entries)
  • engine ∈ {mflux, mlx-video}
  • runtime contains mflux (MLX native) or mlx-video (MLX native)

The detection is conservative: false negatives leave a broken dropdown entry that the smoke test will catch; false positives would silently hide a working variant.

Test plan

  • .venv/bin/python -m pytest tests/test_platform_filter.py -v — 15 / 15 pass
  • .venv/bin/python -m pytest tests/test_backend_service.py tests/test_setup_routes.py tests/test_video_routes.py tests/test_image_discover.py -q — all pre-existing tests still pass
  • Manual verify on macOS: MLX entries still appear in Image Studio + Video Studio
  • Manual verify on Windows: MLX entries no longer appear; GGUF / diffusers entries unchanged

The image and video catalogs surface variants like 'FLUX.1 Dev · mflux
(MLX)' and 'LTX-2 · distilled (MLX)' that route through mflux or
mlx-video on Apple Silicon. Both depend on the mlx wheel which has no
Linux or Windows builds, so picking one of those entries on the wrong
OS is a guaranteed dead end.

Add backend_service/helpers/platform_filter.py with:

- is_apple_silicon(system, machine) — pure-function platform check
  (parameters exposed for tests without monkeypatching).
- is_mlx_only_variant(variant) — detects variants by explicit mlxOnly
  flag, engine == 'mflux' / 'mlx-video', or runtime strings ending
  in 'mflux (MLX native)' / 'mlx-video (MLX native)'.
- filter_mlx_only_families(families, on_apple_silicon=...) — drops
  MLX-only variants on non-Apple hosts and removes families whose
  entire variant set was MLX-only. Returns a new list, never mutates.

Wire the filter into _image_model_payloads (helpers/images.py) and
_video_model_payloads (helpers/video.py) at the end of payload
construction so the catalog routes (/api/images/catalog and
/api/video/catalog) return only the variants that can run on the
current host.

Surfaced by the v0.7.2 smoke test on a Windows / RTX 4090 box: FLUX.1
Dev mflux and the LTX-2 MLX variants showed up in the model dropdowns
but failed at preload time because mlx isn't installable. Filtering
server-side keeps the dropdowns honest without changing any frontend
code.
@cryptopoly cryptopoly merged commit 1e4d3e8 into main May 1, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant