diff options
Diffstat (limited to 'model.py')
| -rw-r--r-- | model.py | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -42,7 +42,8 @@ class CausalSelfAttention(nn.Module): self.n_embd = config.n_embd self.dropout = config.dropout # flash attention make GPU go brrrrr but support is only in PyTorch >= 2.0 - self.flash = hasattr(torch.nn.functional, 'scaled_dot_product_attention') + # Maxwell GPUs (compute 5.0) don't support bf16 ops used by SDPA internals + self.flash = hasattr(torch.nn.functional, 'scaled_dot_product_attention') and getattr(config, 'flash', True) if not self.flash: print("WARNING: using slow attention. Flash Attention requires PyTorch >= 2.0") # causal mask to ensure that attention is only applied to the left in the input sequence |
