You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Best practices for weight dtype and autocasting #438
I might be confused here, but I'm curious of the following:
It seems like if we use TE's autocast with model dtype float32, we don't get to use FlashAttention since it requires the dtype to be bfloat16. If we set the model dtype to bfloat16 TE casting to FP8 will work, and we get FlashAttention, but then according to Gopher we might have convergence issues.
Is this a real concern, and is there a recipe to fix this? Can TE's autocast also support casting to BFloat16 when possible?
Sorry for the confusion, I'm confused myself. If I remember correctly, I made that comment since I ran into issues when combining te.fp8_autocast and torch.autocast, but I haven't been able to reproduce those issues. I suppose combining multiple autocast types might lead to multiple casts (fp32 -> bf16 -> fp8), but Flash Attention/cuDNN attention may be worth that overhead.
Activity
c0g commentedon Sep 19, 2023
MosaicML's blog post says to do both!
c0g commentedon Sep 27, 2023
Hmm actually found this comment: #401 (comment), which cast doubt on this conclusion.
Does TE work with autocast?
timmoon10 commentedon Oct 2, 2023
Sorry for the confusion, I'm confused myself. If I remember correctly, I made that comment since I ran into issues when combining
te.fp8_autocastandtorch.autocast, but I haven't been able to reproduce those issues. I suppose combining multiple autocast types might lead to multiple casts (fp32 -> bf16 -> fp8), but Flash Attention/cuDNN attention may be worth that overhead.ptrendx commentedon Oct 12, 2023
Hi @c0g, does @timmoon10 's comment clear the confusion? TE works with autocast - please open an issue if you see any problem with it :-).