Uh oh!
There was an error while loading. Please reload this page.
Make IPAdapter compatible to torch.compile - #7988
Conversation
yiyixuxu
left a comment
There was a problem hiding this comment.
should we also add a test?
| comps = [] | ||
| for i in l: | ||
| comps.append(i) | ||
| [ln0, ln1, attn, ff] = comps |
There was a problem hiding this comment.
ok but do we know why it has to be done this way? any documentation etc?
e.g. would this work?
forlayerinself.layers:
[ln0, ln1, attn, ff] =layersThere was a problem hiding this comment.
If you try to unpack a ModuleList like above or just like in the original implementation. Following error occurs:
torch._dynamo.exc.Unsupported: UNPACK_SEQUENCE NNModuleVariable()
So I assume that any unpacking with ModuleList is not supported in torch.compile and only for loop through it is supported. Hence, I for loop the ModuleList to not breaking the graph and upack using python list
There was a problem hiding this comment.
I also try moving ln0, ln1, attn, ff into a class, but it will affect the weight loading
There was a problem hiding this comment.
I also try moving
ln0, ln1, attn, ffinto a class, but it will affect the weight loading
hi @rootonchair, you can use the IPAdapterPlusImageProjectionBlock class, but you have to update the loading function too.
I think the final result would be really good, as the code consistency in the library would improve
HuggingFaceDocBuilderDev
commented
May 20, 2024
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
yiyixuxu
commented
May 20, 2024
cc @fabiorigano too |
hi @yiyixuxu thanks for adding me here I think it would be nice to have a forward function that uses the diffusers/src/diffusers/models/embeddings.py Line 892 in d6ca120 that we introduced with the Face ID PR #7186 |
yiyixuxu
commented
May 20, 2024
thanks @fabiorigano! |
rootonchair
commented
May 21, 2024
@yiyixuxu yes it does. As @fabiorigano suggested, we could utilize |
sayakpaul
commented
May 21, 2024
This works for me. Thank you, @rootonchair! Perhaps the use of |
fabiorigano
commented
May 21, 2024
I can open a new PR to use |
sayakpaul
commented
May 21, 2024
That would be great, thank you! |
rootonchair
commented
May 21, 2024
Sure @fabiorigano, thank you |
sayakpaul
commented
May 29, 2024
@rootonchair does #7994 work for you? |
rootonchair
commented
May 29, 2024
@sayakpaul yes it does. Fantastic works |
sayakpaul
commented
May 29, 2024
Fantastic. Would you mind closing the PR then? I am sorry about the inconvenience here. |
rootonchair
commented
May 29, 2024
Ah, no problem. I assume closing #7985 too? |
What does this PR do?
Fixes#7985
Before submitting
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.