Skip to content

Diffusion tests: assert the typed LoRA reload refusal, skip encoder streaming without diffusers - #18535

Merged
danielhanchen merged 1 commit into
mainfrom
ci/diffusion-tests-follow-18420-18424
Nov 19, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
ci/diffusion-tests-follow-18420-18424

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Summary

(Python 3.13, diffusion) fails on main for every PR (seen on #18526 and #18348, neither of which touches diffusion). Four tests, from two recent merges:

FAILED tests/test_diffusion_backend.py::test_apply_loras_quant_unbaked_requires_reload
FAILED tests/test_diffusion_backend.py::test_apply_loras_quant_baked_matrix
    Expected regex: 'Reload the model with the adapter selection'
    Actual message: 'This INT8 build was loaded without LoRA adapters, ... Reload the model with the LoRA selection: on the Images page click Reapply ...'
FAILED tests/test_diffusion_te_residency.py::test_release_streams_and_restore_unhooks_with_identical_outputs
    assert 0 == 4   (release('test') == r.mib)
FAILED tests/test_diffusion_te_residency.py::test_a_restore_that_runs_out_of_memory_keeps_streaming
    assert True is False

Root causes

LoRA reload refusal (#18420). #18420 turned this refusal into LoraReloadRequiredError and rewrote its message to name the remedy (Reapply on the Images page, or loras in /images/load). The routes key on the type (X-Unsloth-Refusal: lora-reload, error.code = "lora_reload_required"). The two tests still matched the old wording. The behaviour is intended; the tests pinned prose.

Encoder residency streaming (#18424). EncoderResidency.release() streams the text encoders through diffusers' group offloading. The (Python 3.13, diffusion) lane does not install diffusers (the same log shows No module named 'diffusers' skips), so the stream fails, release() correctly keeps the encoders resident and returns 0, and the two tests that need a real stream fail. The module is right to refuse; the tests needed diffusers and did not say so.

Changes

  • test_diffusion_backend.py: both tests assert pytest.raises(LoraReloadRequiredError, match = "Reload the model with the LoRA selection"), the typed refusal plus the remedy phrase both messages share.
  • test_diffusion_te_residency.py: the two streaming tests are marked to skip when importlib.util.find_spec("diffusers") is None. Only the absence of diffusers skips: with diffusers installed, a regression in Unsloth's streaming still fails them. The tests that do not stream (host RAM refusal, a failed stream putting the encoders back) keep running everywhere.

Test-only change.

Testing

  • With diffusers 0.43.0 (current release) on a CPU host: pytest tests/test_diffusion_te_residency.py tests/test_diffusion_backend.py: 733 passed, the two streaming tests included.
  • Sabotage: raising a plain LoraSelectionError instead of LoraReloadRequiredError fails both LoRA tests.
  • The no-diffusers lane is the (Python 3.13, diffusion) job on this PR.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-19T22:32:51.491719Z 7679d6c Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: 7679d6c008

ℹ️ 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".

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