Skip to content

Diffusion backend tests: give the fake torch an nn.Module (16 failures since #18081) - #18100

Merged
danielhanchen merged 1 commit into
mainfrom
ci-diffusion-fake-torch-nn
Nov 17, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
ci-diffusion-fake-torch-nn

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

The Studio diffusion CPU shard has 16 failures in tests/test_diffusion_backend.py on main since #18081 (seen on the staging run of #18087, a frontend-only PR):

core/inference/diffusion_lora_files.py:532: in _lora_components
    return list({id(m): m for m in roots if isinstance(m, torch.nn.Module)}.values())
E   AttributeError: module 'torch' has no attribute 'nn'
E   ValueError: Failed to apply LoRA: module 'torch' has no attribute 'nn'

The other 15 (test_dense_build_cancellation_boundaries[*], test_dense_quant_lora_bake_attaches_before_quantize, test_a_pipeline_pick_bakes_its_adapters_before_quantising) are the same error, surfacing as "The requested LoRA adapters could not be applied".

Cause

#18081 made load_adapter snapshot the requires_grad flags of the pipe's torch.nn.Module components so unloading can restore them. That is correct with real torch. The fake_runtime fixture installs a minimal fake torch module with no nn, so every adapter load in these tests now raises.

Fix

The fake torch gets nn.Module (an empty class). The fake pipe components are not modules, so the snapshot is empty and the tests exercise the same paths as before. No production change.

Verification

tests/test_diffusion_backend.py, -n 4:

  • main: 21 failed (the 16 CI failures, plus 5 test_download_plan_for_minimax_h3_image_* cases that fail on this host only, from its local diffusers build, and pass in CI).
  • this branch: the 16 pass; only the same 5 host-only cases remain.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 17, 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-17T07:26:13.027679Z 28c3981 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 28c3981b6d

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

@danielhanchen
danielhanchen merged commit fb0c585 into main Nov 17, 2026
@danielhanchen
danielhanchen deleted the ci-diffusion-fake-torch-nn branch November 17, 2026 07:26
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