Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attention in Motion Module of UNetMotionModel #7968

Closed
huyduong7101 opened this issue May 17, 2024 · 3 comments
Closed

Attention in Motion Module of UNetMotionModel #7968

huyduong7101 opened this issue May 17, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@huyduong7101
Copy link

Describe the bug

As far as I know, UNetMotionModel is adopted for AnimateDiff. Hence, I look into the original implementation of AnimateDiff, it is noticed that they use cross-attention in Motion Module (https://github.com/guoyww/AnimateDiff/blob/main/animatediff/models/unet_blocks.py#L382). On the contrary, Diffusers uses self-attention (https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/unets/unet_3d_blocks.py#L1175)

Reproduction

hidden_states = motion_module(
                hidden_states,
                num_frames=num_frames,
                encoder_hidden_states=encoder_hidden_states,
            )[0]

Logs

No response

System Info

Diffusers 0.27.2

Who can help?

@DN6 @yiyixuxu @sayakpaul

@huyduong7101 huyduong7101 added the bug Something isn't working label May 17, 2024
@yiyixuxu
Copy link
Collaborator

cc @DN6

@DN6
Copy link
Collaborator

DN6 commented May 22, 2024

Hi @huyduong7101 Cross Attention support does exist in the original AnimateDiff codebase, however it isn't actually used in the model.

Here cross_attention_dim is set to None
https://github.com/guoyww/AnimateDiff/blob/cf80ddeb47b69cf0b16f225800de081d486d7f21/animatediff/models/motion_module.py#L189

because the block types are Temporal_Self
https://github.com/guoyww/AnimateDiff/blob/cf80ddeb47b69cf0b16f225800de081d486d7f21/configs/inference/inference-v1.yaml#L13

@DN6
Copy link
Collaborator

DN6 commented Jun 3, 2024

Closing this for now. If you have further questions @huyduong7101 please feel free to create a post in the Discussions section.

@DN6 DN6 closed this as completed Jun 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants