We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Test code from this:
import time import torch import torch.nn.functional as F N = 32 L = 2048 dims = 64 n_heads = 8 q = torch.randn(N, n_heads, L, dims, dtype=torch.float16).cuda() k = torch.randn(N, n_heads, L, dims, dtype=torch.float16).cuda() v = torch.randn(N, n_heads, L, dims, dtype=torch.float16).cuda() dropout_rate = 0.2 num_trials = 10 with torch.backends.cuda.sdp_kernel( enable_flash=True, enable_math=False, enable_mem_efficient=False ): attn_bias = torch.zeros(N, n_heads, L, L, dtype=q.dtype).to(q.device) torch.cuda.synchronize() start = time.time() for i in range(num_trials): out = F.scaled_dot_product_attention(q, k, v, attn_mask=attn_bias, dropout_p=dropout_rate) torch.cuda.synchronize() end = time.time() print('Flash attention took {} seconds for {} trials'.format(end - start, num_trials))
Errors:
Related issues: Dao-AILab/flash-attention#352
The text was updated successfully, but these errors were encountered:
Thanks! We fixed that by turning to xformers. See https://github.com/PKU-YuanGroup/Open-Sora-Plan/blob/main/opensora/models/diffusion/latte/latte.py#L109-L118
Sorry, something went wrong.
Bin God 🙏🙏
No branches or pull requests
Test code from this:
Errors:
Related issues:
Dao-AILab/flash-attention#352
The text was updated successfully, but these errors were encountered: