Allow Flux2 to use MagCache - #14351
Conversation
| elif diff > 0: | ||
| residual = out_hidden - in_hidden[:, diff:] # Fallback to matching tail | ||
| else: | ||
| residual = out_hidden - in_hidden # Fallback to matching tail | ||
| residual = out_hidden[:, -diff:] - in_hidden # Fallback to matching tail |
There was a problem hiding this comment.
This branch of the if statement appears to have the intent to slice out the text encoding if it remains within the hidden state, but it was never been implemented (if you look on main, there is an if-else that does the exact same thing). On flux 2, this will error out because out_hidden ends up as size 4608 while in_hidden ends up as 4096 due to the single transformer block returning a fused hidden state (there is a single transformer block kwarg to break it into encoder_hidden_state and hidden_state, but I believe it would break other things and possibly the pipeline and it's cleaner to just deal with it here).
|
Hi @Ednaordinary, thanks for the PR! It does not appear to link an issue it fixes. If this PR addresses an existing issue, please add a closing keyword (e.g. |
What does this PR do?
MagCache on Flux2 used to error out, this should fix it by adding flux2 to hooks (maybe allowing it to be used by other caches? I haven't checked) and fixes a case in MagCache that a code comment signaled intent to handle but never did.
Tested on 3090 ti
Test script
Steps v
this cat has many limbs
Before submitting
self-reviewskill on the diff?documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.
@AlanPonnachan @sayakpaul