-
-
Notifications
You must be signed in to change notification settings - Fork 166
support python < 3.9 & fix nan when pytorch < 2.5 & fix deepspeed train type mismatch #23
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
base: main
Are you sure you want to change the base?
Conversation
|
Thank you for this, I will merge this. However, please note that it is difficult to maintain compatibility in the future (and compatibility may be lost accidentally), because we do not have PyTorch 3.9 environment. If that case occurs, please send another PR to fix it. Regarding 2, there is a comment in the diffusers' pull request, will it be okay with PyTorch 2.5.1? : huggingface/diffusers@01bd796#commitcomment-151162702 |
yes, pytorch 2.5.1 is okay. |
| attn_mask = torch.zeros((bs, 1, max_seqlen_q, max_seqlen_q), dtype=torch.bool, device=text_mask.device) | ||
| attn_mask = torch.zeros((bs, 1, max_seqlen_q), dtype=torch.bool, device=text_mask.device) | ||
|
|
||
| # set attention mask with total_len | ||
| for i in range(bs): | ||
| attn_mask[i, :, : total_len[i], : total_len[i]] = True | ||
| attn_mask[i, :, : total_len[i]] = True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fix seems to result in the following error in PyTorch 2.5.1:
x = F.scaled_dot_product_attention(q, k, v, attn_mask=attn_mask, dropout_p=drop_rate, is_causal=causal)
RuntimeError: The expanded size of the tensor (24) must match the existing size (3) at non-singleton dimension 1. Target sizes: [3, 24, 2296, 2296]. Tensor sizes: [3, 1, 2296]
Could you please revert this fix? Without this fix, it would work with --split_attn on versions prior to PyTorch 2.5.1.
|
With the introduction of |
change type list to List
see huggingface/diffusers@01bd796
original code:
context_aware_representations = self.c_embedder(context_aware_representations)fix code:
context_aware_representations = self.c_embedder(context_aware_representations.to(dtype=x.dtype))