Skip to content

Fix main: the two diffusers-import preflight tests only pass on a GPU host - #8281

Merged
danielhanchen merged 4 commits into
mainfrom
fix-dit-preflight-tests-on-cpu
Aug 10, 2026
Merged

danielhanchen merged 4 commits into
mainfrom
fix-dit-preflight-tests-on-cpu

Conversation

@danielhanchen

@danielhanchen danielhanchen commented Aug 9, 2026 •

Copy link
Copy Markdown
Member

main is red on the Python matrix: test_route_start_refuses_a_diffusers_whose_lazy_submodule_cannot_import and test_route_start_refuses_training_when_diffusers_is_absent fail on 3.10, 3.11, 3.12 and 3.13, and every open PR inherits them.

Both tests post a krea-2 start and assert the diffusers reason survives into the 400 body:

assert "No module named 'diffusers'" in r.json()["detail"]
E  assert "No module named 'diffusers'" in 'Training the DiT families needs a GPU: even
   the 4-bit (nf4) base load requires CUDA, XPU or MPS, and this host has none. Train
   SDXL here, or use a GPU machine.'

training_precision_preflight_error runs before training_pipeline_import_error on the start route, and its dit_accelerator_missing_reason gate fires first on a GPU-less runner. So on CI these two assert nothing about the import guard they exist to cover, and fail. On a GPU box they pass, which is how they were written. They did not go in green: #8236's own Backend CI was already failing on (Python 3.11), (Python 3.12) and (Python 3.13) with these exact two at merge time, the same way #8163 merged red earlier today. Nobody is at fault for a check that was red when it landed; this just clears it.

The route ordering is right as it stands. Telling someone on a CPU host that training needs a GPU is more use than telling them diffusers is missing, and the accelerator gate is the cheaper check. What is wrong is that the tests depend on the host.

conftest.dit_train_host already exists for exactly this, and the neighbouring family-metadata tests use it, including test_route_start_still_runs_when_the_install_does_have_the_pipeline a few lines up. Requesting it here pins dit_accelerator_missing_reason and bf16_unsupported_reason to None so the request reaches the import guard on any host. The gate itself keeps its own coverage in test_diffusion_base_precision.py.

Verification, studio/backend/tests/test_diffusion_training.py run twice on this box:

before after
CUDA_VISIBLE_DEVICES="" 2 failed, 116 passed 118 passed
CUDA_VISIBLE_DEVICES=0,1,2,3 118 passed 118 passed

…ests

Both of these post a krea-2 start and assert the diffusers reason comes back in
the 400. On a GPU-less runner the accelerator gate is earlier in the route and
answers "Training the DiT families needs a GPU" instead, so on CI they assert
nothing about the import guard and fail outright. They pass on a GPU box, which
is why this only showed up after the merge.

conftest already has dit_train_host for exactly this, and the neighbouring
family-metadata tests use it. Request it here too, so both assert the same
thing on every host. Verified with the file run twice, once with
CUDA_VISIBLE_DEVICES empty and once with the GPUs visible: 118 passed both
times, against 2 failed / 116 passed on CPU before.
@danielhanchen

Copy link
Copy Markdown
Member Author

The two red checks on this PR are not failures. Backend CI here is:

job wall time conclusion
Repo tests (CPU) 13 min success
(Python 3.13) 14 min success
(Python 3.12) 14 min success
(Python 3.11) 15 min cancelled
(Python 3.10) 15 min cancelled

Both cancellations are the workflow's timeout-minutes: 15, which the suite has outgrown: every job that finishes takes 14 to 15 minutes. gh pr checks renders a cancelled job as fail, and gh run rerun --failed does not pick one up at all, which is why re-running has not cleared them. #8286 raises the limit to 30 and its own matrix then completed all four jobs, three of them past 15 minutes.

So this PR cannot show a fully green Backend CI until #8286 merges, and the interpreters that did complete, 3.12 and 3.13, both pass with the fix. If both land, #8286 first is the useful order.

@danielhanchen

Copy link
Copy Markdown
Member Author

Rebased onto current main (0f25909d) now that #8213, #8222, #8232, #8243 and #8283 have landed. Clean merge, no conflicts.

I went back over the Backend CI red with job conclusions rather than gh pr checks, because gh pr checks renders both cancelled and failure as fail and that has been misleading here. Run 31331200939 on this branch, gh api .../actions/runs/31331200939/jobs:

job conclusion wall clock
Repo tests (CPU) success 13m26s
(Python 3.13) success 14m14s
(Python 3.12) success 14m49s
(Python 3.11) cancelled 15m08s
(Python 3.10) cancelled 15m09s

Zero failure conclusions. 3.13 was a genuine failure before this change and is green after it, which is the change doing its job. The two remaining reds are cancelled at 15m08s and 15m09s against timeout-minutes: 15, so they are the job timeout, not a defect on this branch, and nothing about them is specific to this PR.

That timeout is #8286, and the two are complementary rather than alternatives. On #8286 (run 31336510033) all four interpreters run to completion under the raised budget and all four fail, with exactly these two tests:

FAILED tests/test_diffusion_training.py::test_route_start_refuses_a_diffusers_whose_lazy_submodule_cannot_import
FAILED tests/test_diffusion_training.py::test_route_start_refuses_training_when_diffusers_is_absent

So this PR removes the genuine failures but leaves two coin-flip timeouts, and #8286 removes the timeouts but leaves four genuine failures. Merge this one first, then #8286, and Backend CI is green on all four interpreters for the first time since #8236.

Re-verified on the rebased tree, studio/backend/tests/test_diffusion_training.py:

before after
CUDA_VISIBLE_DEVICES="" 2 failed, 116 passed 118 passed
CUDA_VISIBLE_DEVICES=0,1 118 passed 118 passed

@danielhanchen

Copy link
Copy Markdown
Member Author

Backend CI on the rebased head 0f25909d, run 31350359773, by job conclusion:

job conclusion wall clock
Repo tests (CPU) success 13m45s
(Python 3.10) success 14m55s
(Python 3.11) success 14m23s
(Python 3.12) success 14m59s
(Python 3.13) cancelled 15m06s

Four of five green against current main, and no failure conclusion anywhere: the two tests this PR touches now pass on every interpreter that was allowed to finish. The one red is 3.13 cancelled at 15m06s, six seconds over timeout-minutes: 15, with 3.12 landing at 14m59s on the same run. That is the coin flip #8286 is about, and it flipped a different way this time than last (3.13 was one of the two that finished before, 3.10 and 3.11 were the two that did not). I have re-run just that job.

I also ran the workflow's exact CPU-only invocation on the rebased tree on my own box (12m33s, 20192 passed). It carries 52 failures that box has regardless of this branch, none of them in test_diffusion_training.py, which is 118 passed there both with and without a visible GPU. The clean-runner numbers above are the ones that settle it.

…an show green

These two changes are complementary and neither can demonstrate itself alone. The test fix
removes the only genuine failures in the matrix, but leaves the 15 minute job timeout, which
the suite now runs 14.1 to 15.0 minutes against, so a different interpreter is cancelled on
each run and the result is a coin flip rather than a verdict. Raising the timeout alone lets
all four interpreters finish and all four then fail on exactly the two tests fixed here.

Kept apart they force a merge in a specific order, with the first one going in over a red check
that can only be argued about rather than shown. Together, one run either goes green or does
not. The timeout is the guard against a hang, which 30 minutes still is; it was never meant to
be a performance budget, and the suite's runtime remains the real problem underneath.
@danielhanchen

Copy link
Copy Markdown
Member Author

Folded #8286's two-line timeout-minutes bump into this branch, and merged current main.

The reason is that neither change can demonstrate itself alone, which was leaving both stuck.

This PR removes the only genuine failure conclusions in the matrix. It does not touch the 15 minute job timeout, which the suite now runs 14.1 to 15.0 minutes against, so a different interpreter gets cancelled on each run. On the last round here that was 1 job of 5; the round before it was 2 of 5, on a different interpreter. gh pr checks reports a cancellation as fail, so this PR could only ever be merged over a red check that I can argue about rather than show as a pass.

#8286 raises the timeout and nothing else. On its run 31336510033 all four interpreters finished for the first time, and all four then came back failure on exactly the two tests fixed here.

So the two are complementary, and kept apart they force a merge in a specific order with the first one going in red. Together, one run either goes green or it does not.

The timeout is the guard against a hang, which 30 minutes still is. It was never a performance budget. A suite that takes 14.5 minutes is the real problem and 30 buys time rather than headroom, so that still wants doing separately.

Evidence for the test fix itself, on this tree: studio/backend/tests/test_diffusion_training.py is 118 passed at both CUDA_VISIBLE_DEVICES="" and 0,1. Before the change, the same file at "" was 2 failed, 116 passed, the two being test_route_start_refuses_a_diffusers_whose_lazy_submodule_cannot_import and test_route_start_refuses_training_when_diffusers_is_absent. Both post a krea-2 start and assert the diffusers reason reaches the 400 body; on a GPU-less runner the accelerator gate at routes/training.py:2775 answers "Training the DiT families needs a GPU" before the import gate at :2785 is reached, so without the dit_train_host fixture they assert nothing about the guard they are named for.

If this goes green, #8286 is redundant and I will close it pointing here.

@danielhanchen
danielhanchen merged commit f7ea9fa into main Aug 10, 2026
41 checks passed
@danielhanchen
danielhanchen deleted the fix-dit-preflight-tests-on-cpu branch August 10, 2026 04:27
danielhanchen added a commit that referenced this pull request Aug 10, 2026
Picks up #8281, which fixed the two diffusers-import preflight tests that only passed on a GPU host. This branch's merge base predates it, so Backend CI was replaying that failure on the CPU runner.
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