NVIDIA / TransformerEngine

A library for accelerating Transformer models on NVIDIA GPUs, including using 8-bit floating point (FP8) precision on Hopper and Ada GPUs, to provide better performance with lower memory utilization in both training and inference.
https://docs.nvidia.com/deeplearning/transformer-engine/user-guide/index.html
Apache License 2.0
1.85k stars 309 forks source link

nan loss when training in fp8 with rotary embedding #962

Open saurabh-kataria opened 3 months ago

saurabh-kataria commented 3 months ago

Loss in nan in the first batch of training itself when transformer architecture uses rotary embedding

saurabh-kataria commented 3 months ago

figured it is not an issue with TransformerEngine. It's just that the fp8 training is highly sensitive to model initialization.

saurabh-kataria commented 3 months ago

Actually the nan loss arises later on too after just 25% of training.

P.S. This may not be about rotary embedding package but the stability of fp8 itself. Maybe if someone can share best practices to use this, it would be great.