Repository navigation
Unsloth Studio: note that a block's return signature alone does not justify FBCache metadata - #11553
LeoBorcherding wants to merge 3 commits into
Conversation
Registering the block as (0, None) let enable_cache succeed, and every Qwen-Image 2.1 generation then failed at the first step inside FBCache's _should_compute_remaining_blocks on a sequence length mismatch: the transformer hands the block a JOINT text+image sequence, and the pipeline's cond and uncond passes carry different text lengths. diffusers ships no metadata for that class. An unregistered class renders uncached, which costs the step-cache saving; a wrongly registered one cannot generate at all. Drop the entry and keep the registration machinery for a block that genuinely needs one. The test that asserted the registration now asserts its absence, so a re-add from reading the block's return signature fails loudly.
|
Thanks for chasing this down, but I do not think this one should land as it stands. Three things. The crash is already fixed on your base. #11546 landed in The stated cause does not hold. Five of the eight files are formatter churn. What I would do with it: drop the code change and keep the comment. The warning against adding a block back on the strength of reading its return signature is worth having, and it belongs next to the entry rather than in place of it. The entry itself should stay, because it is what makes The real open question is still the one you named at the end: whether FBCache can be made correct across a prefix KV denoise loop at all, which would give the step-cache saving back on a 20+ step model. That is worth doing and is a different change. |
…ustify FBCache metadata The crash this branch opened against was already fixed on its base by unslothai#11546, whose _reuses_prefix_kv refuses the cache before the registry is consulted, so the entry is restored and only the warning is kept. The earlier cause was wrong too: the sequence shortens between step 0 and step 1 under prefix KV reuse, not between the cond and uncond passes, which cache_context keeps in separate states anyway. Also reverts the pre-commit.ci formatter churn in five unrelated files.
|
Agreed, dropping the code change. Pushed The five formatter files are out. They came from One correction on the last point: an unregistered class does not raise out of On that: happy to take it as a separate change if it is wanted. |
Comment only. No behaviour change.
#11546 already fixes the crash this branch was opened for:
_reuses_prefix_kvrefuses FBCache before the registry is consulted, so removing theQwenImage21TransformerBlockentry changes nothing about it. The entry is restored and only the warning is kept, beside it rather than in place of it.The cause as originally written was also wrong. The sequence length changes between step 0 and step 1 under prefix KV reuse (4096 image-only at 1024, 4260 joint, 164 text prefix), not between the cond and uncond passes, which
cache_context("cond")andcache_context("uncond")keep in separate states.Verification
From
studio/backend, ate3852eb1d2:No hardware run, and none is needed: the diff is five lines of comment.