Skip to content

Diffusion trainer tests: run against the real conditioning cache - #18480

Merged
danielhanchen merged 1 commit into
mainfrom
ci/dit-rekey-test-real-cache
Nov 19, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
ci/dit-rekey-test-real-cache

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Summary

(Python 3.13, diffusion) fails on main for every PR (seen on #18477, which only touches Hub frontend hooks):

FAILED tests/test_diffusion_windows_rocm_wide_head.py::test_dit_trainer_guards_the_preview_vae_a_warm_cache_loads[False]
core/training/diffusion_dit_trainer.py:3050: in _rekey_conditioning_cache
    if (fresh.family, getattr(fresh, "text_encoder", "")) == (
E   AttributeError: 'object' object has no attribute 'family'

Reproduced locally on main at 3ee3907c23.

Root cause

#18386 added _rekey_conditioning_cache, which reopens the persistent conditioning cache once the conditioners are on disk and compares its namespace (family, text_encoder) with the one the run opened. That is correct for the real PersistentConditioningCache, which always sets both attributes in __init__.

The test replaced PersistentConditioningCache with lambda *_a: object(), a bare object with none of the cache's attributes. It only worked while the cold path never read one. So the trainer change is fine and the stub was too thin.

Changes

  • test_diffusion_windows_rocm_wide_head.py and test_diffusion_training_download_phases.py no longer stub PersistentConditioningCache. Both already point cond_cache_dir at tmp_path, and the real constructor only creates that directory, so the tests now run against the real cache and keep working when the trainer reads another of its attributes. The encode and warm-load steps around it stay stubbed as before, so nothing is encoded or downloaded.

No source change.

Testing

  • pytest tests/test_diffusion_windows_rocm_wide_head.py tests/test_diffusion_training_download_phases.py (from studio/backend): 19 passed; on main the [False] case fails as above.
  • The existing tests/test_diffusion_cond_cache_rekey.py covers _rekey_conditioning_cache itself and is unchanged.

@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-19T13:59:26.125096Z 1b1bb31 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. Keep it up!

Reviewed commit: 1b1bb316e4

ℹ️ 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 701e176 into main Nov 19, 2026
@danielhanchen
danielhanchen deleted the ci/dit-rekey-test-real-cache branch November 19, 2026 14:00
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