About attention mask
Thanks for your awesome work! However, I have questions about the attention mask.
https://github.com/Gen-Verse/MMaDA/blob/b347cf3cbc8181631b358aa6d1922a9438c98949/models/modeling_mmada.py#L160-L162
The code above computes attention mask to prevent normal tokens from attending [PAD] tokens. However, it appears that the attention mask is NOT USED indeed (see this, attention_bias is not passed to _scaled_dot_product_attention). Is this intentional? Could this make training difficult and degrade the performance? Or do I misunderstand something?
PS: I am also confused about the implementation of attention_mask. The code above is in the loop of unmasking steps. The concatenation is conducted at each step, keeping increasing the first dimension of attention_mask. Is there any issue here?
Hi, thanks for your attention. This was a bug and you can check this pr: https://github.com/Gen-Verse/MMaDA/pull/19, where I fix this bug.
However, we have not verified whether this fix will affect training so it's yet to be merged before we complete a training process to verify. You can use this pr in training and any outcomes are welcome to discuss!
@tyfeld I find that attn_mask will significantly slow down the generation speed. In my experiments on an A800 GPU, generating a 512x512 image in 15 steps costs 4-5s when attn_mask=None, but when attn_mask is passed to F._scaled_dot_product_attention, the generation time will reach 10s. Do you know why? Is it possible to fix it?