Repository navigation
Studio: CPU-only devices run image and video models as GGUFs on sd.cpp only - #18444
Conversation
…diffusers fallback On a CPU-only torch the Hub plan stages a GGUF's native files (GGUF + VAE + GGUF text encoder), but when the sd.cpp build could not be installed or run at load time the router fell back to diffusers, which then downloaded the dense bf16 text encoder inline. For FLUX.3 Klein UD-Q2_K_XL that is 7.2 GB staged and 11.8 GB opened (8.9 GB new), to run on PyTorch CPU. An automatic GGUF load of a natively mapped family on a CPU torch is now refused with the native reason before anything unloads, and the plan refuses the same pick. An explicit Diffusers engine pick, UNSLOTH_DIFFUSION_ENGINE=diffusers, UNSLOTH_DIFFUSION_SD_CPP=0 and the new UNSLOTH_DIFFUSION_CPU_GGUF_DIFFUSERS_FALLBACK=1 still reach diffusers.
|
@codex review |
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. |
|
Codex Review: Didn't find any major issues. Bravo. 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". |
A GGUF image load of a family sd.cpp supports on a CPU-only torch now runs on the native engine only. An explicit Diffusers pick, the UNSLOTH_DIFFUSION_ENGINE=diffusers pin and UNSLOTH_DIFFUSION_SD_CPP=0 are refused for it too, in the load and in the download plan, so the dense diffusers set is never staged. Only the developer switch UNSLOTH_DIFFUSION_CPU_GGUF_DIFFUSERS_FALLBACK=1 restores the diffusers route. The refusal now says what failed and how to fix it. The sd.cpp start probe records why a build could not start: a Windows loader status (STATUS_DLL_NOT_FOUND and friends) names the Microsoft Visual C++ Redistributable, since the win-cpu-x64 build imports MSVCP140, VCRUNTIME140 and VCOMP140; a failed prebuilt download names the network; an old build names the reinstall. The Images page hides the Diffusers engine choice on a CPU-only host (status gguf_diffusers_allowed=false) and never sends a remembered one.
…UF route The picker classified a CPU host as gguf-only but only used that to drop the MiniMax-H3 pipeline, so a CPU-only device still listed the FP8 / INT8 / bnb rows and the bf16 pipeline row that a GPU labels Fast FP8, which loads 20.3 GB of bf16 for FLUX.3 Klein on torch CPU. classifyHost now returns cpu-only for a plain CPU backend (a Mac stays gguf-only), and curatedArtifactIsOfferable drops every non-GGUF row of an image or video group that has a GGUF row (or a native route with no curated GGUF, Krea 2) there. The backend refuses the same picks: image pipeline and single-file loads of a family with an sd.cpp route, and video loads of a family whose GGUF is a curated row, on a CPU-only torch. Families with no GGUF route keep their rows. The developer switch UNSLOTH_DIFFUSION_CPU_GGUF_DIFFUSERS_FALLBACK=1 lifts it; the backend test conftest sets it so GPU-path tests keep running on a CPU test host. The native-engine refusal reports the probe's own reason (installer import, install folder in use, a build already recorded as unable to run), and a Windows loader status points at the engine folder before the Visual C++ runtime.
|
@codex review |
1 similar comment
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9f24d5982b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
| // Modular Diffusers needs mem_get_info, which torch.mps lacks. | ||
| if (deviceType === "mac") return "gguf-only"; | ||
| if (!(backend && budgetKnown)) return "unknown"; | ||
| if (backend === "cpu") return "cpu-only"; |
There was a problem hiding this comment.
Classify a confirmed CPU backend before the Mac fallback
On a Mac without usable MPS, such as an Intel Mac, the earlier deviceType === "mac" return prevents this CPU classification from running. Consequently, curatedArtifactIsOfferable still offers non-GGUF image and video rows, while the new backend guards reject those same selections because resolve_diffusion_device_target().backend is "cpu". This leaves users with advertised models whose download plans or loads always fail. Check a confirmed CPU backend before the Mac fallback, while retaining gguf-only for actual MPS/MLX hosts.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 3feefd0. classifyHost now returns cpu-only for a confirmed cpu backend before the Mac fallback, so an Intel Mac hides the same dense rows the backend refuses there. A Mac reporting mlx, or a backend not known yet, stays gguf-only. The policy tests cover both.
|
@codex review |
1 similar comment
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3feefd0f27
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
| repo = str(getattr(fam, "gguf_repo", None) or "").lower() | ||
| if kind == "gguf" or repo not in CPU_GGUF_ONLY_VIDEO_REPOS: | ||
| return |
There was a problem hiding this comment.
Distinguish LTX-2.0 from LTX-2.3 before refusing dense loads
On a CPU-only host, this also rejects the LTX-2.0 pipeline, which the picker still offers. detect_video_family('Lightricks/LTX-2') resolves to the shared ltx-2 family whose gguf_repo is unsloth/LTX-2.3-GGUF, so checking only that family field incorrectly applies the LTX-2.3 restriction to LTX-2.0. Meanwhile, model-catalog.ts lists Lightricks/LTX-2 in its own group without a GGUF artifact, so the new frontend filter retains it, but both download planning and loading reject it through validate_load_request. Make the refusal distinguish the selected version rather than relying solely on the shared family's GGUF repository.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in the latest push. refuse_cpu_dense_video_pick now takes the pick's repo ids and file name. For the shared ltx-2 family it refuses only when one of them names 2.3 (LTX-2.3, ltx2.3, ltx23). An LTX-2.0 pick (Lightricks/LTX-2, or an ltx-2-19b file) keeps its pipeline row and its load, as the picker shows it. The tests cover both versions and validate_load_request('Lightricks/LTX-2'), which the previous head refused.
…t LTX-2.0 [skip ci]
|
@codex review |
1 similar comment
|
@codex review |
|
Codex Review: Didn't find any major issues. Swish! 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". |
…rows Its MLX stack can be unusable while diffusers still runs those rows on MPS, and the backend only refuses dense picks when the diffusion target itself is cpu.
… or MPS probes resolve_diffusion_device_target() reads the card's compute capability, which initialises CUDA in the server on the first idle poll; the poll only needs to know whether the diffusion target is the CPU.
|
@codex review |
1 similar comment
|
@codex review |
|
Codex Review: Didn't find any major issues. Nice work! 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". |
#18420 (#18536) ## Summary `Repo tests (CPU, studio)` fails on `main` (seen on #18444): ``` FAILED tests/studio/test_model_picker_contracts.py::test_a_plan_that_lands_after_a_newer_pick_is_dropped E AssertionError: features/images/images-page.tsx: a superseded plan is not dropped ``` ## Root cause #18420 added `dropReleasedPick(ownRevert);` to both superseded-plan guards in `images-page.tsx`'s `loadOrStage`, between `pickToast.dismiss(pickToastId);` and `return true;`, so a pick released while it was the newest is cleaned up. The behaviour this test protects is unchanged: a plan that lands after a newer pick still returns `true` (started), so its rollback does not fire at the newer pick's label. The test's regex allowed only the toast dismiss before the `return`, so it no longer found either guard. ## Changes - Both regexes in the test now allow plain call statements (`name(...);`) between the toast dismiss and the `return`, and still require the guard's condition and `return true` / the fallback-load ordering exactly as before. One line says why. Test-only change. ## Testing - `pytest tests/studio/test_model_picker_contracts.py`: 205 passed (the test fails on `main`). - Sabotage: turning the first guard's `return true;` into `return false;` fails the test ("a superseded pick reports failure").
Problem
On a CPU-only device, the Model hub plans a GGUF image download for the native sd.cpp engine. For FLUX.3 klein UD-Q2_K_XL that is the GGUF (2.62 GB), the VAE (0.34 GB) and
Qwen3-VL-4B-Instruct-Q8_0.gguf(4.28 GB), 7.24 GB in all.If sd.cpp cannot start at load time, the router silently fell back to diffusers. The fallback fetched the dense bf16 Qwen3-VL-4B text encoder and configs inline (11.84 GB, 8.89 GB of it new), ignored the GGUF encoder the hub had just fetched, and ran on PyTorch CPU. Every catalog GGUF image family has the same gap; MiniMax-H3-Image is the worst at 151 GB against a 34 GB native plan.
The picker also offered non-GGUF rows on CPU. Examples are the FLUX.3 klein row labelled "Fast FP8" on a GPU, and the FP8, INT8 and bnb rows. On CPU they load bf16 on PyTorch: the FLUX.3 klein pipeline row alone is a 20.32 GB plan, which does not fit a 16 GB machine.
Change
The rule: on a CPU-only device, image and video models of a family with a GGUF route run as GGUFs on sd.cpp only.
Backend:
/images/download-plan,/images/loadand the hub's required-files plan, so nothing large is downloaded.UNSLOTH_DIFFUSION_CPU_GGUF_DIFFUSERS_FALLBACK=1, for developers.Frontend:
classifyHostreturns a newcpu-onlyclass for a plain CPU backend. A Mac keepsgguf-only, so its rows are unchanged.cpu-only,curatedArtifactIsOfferabledrops every non-GGUF row of an image or video group that has a GGUF row. The Images and Video tab rows and the picker browse rows follow the same rule./images/statusreportsgguf_diffusers_allowed. When it is false, the Images Advanced Engine select drops Diffusers, and a remembered Diffusers pick is sent as Auto.GPU devices and MPS are unchanged.
Tests
ggufmodule and a diffusers import error in the test venv). Two tests readmodel-catalog.tsand check that the backend refuses exactly what the picker hides.host-artifact-policy.test.ts21/21, the engine-choice tests 24/24,model-catalog.check.tsandtsc --noEmitpass.Not run: a real Windows or macOS machine.
Screenshots
Two Studio installs from this PR's base and head on a CPU-only host (
device_backend: cpuon both). In the unfiltered picker the image rows go from 44 to 27; SDXL, which has no GGUF route, keeps its 2 rows.FLUX.3: the two BF16 rows are gone; only the two GGUF rows are offered.
Z-Image: the BF16 and bnb-4bit Z-Image-Turbo rows are gone; Z-Image-Turbo-GGUF and Z-Image-GGUF remain.
Krea 2: the BF16 Krea 2 Turbo row is hidden (sd.cpp runs Krea 2 GGUFs, and there is no curated GGUF row yet).