Hide MLX-only variants on non-Apple platforms#21
Merged
cryptopoly merged 1 commit intomainfrom May 1, 2026
Merged
Conversation
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.
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
backend_service/helpers/platform_filter.pywithis_apple_silicon(),is_mlx_only_variant(), andfilter_mlx_only_families()._image_model_payloadsand_video_model_payloadsso the/api/images/catalogand/api/video/catalogresponses drop MLX-only variants on Linux / Windows.LTX-2 (MLX)family disappears on Windows rather than rendering an empty card).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 fourprince-canuma/LTX-2-*MLX entries. Both routes depend onmlx, 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}runtimecontainsmflux (MLX native)ormlx-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