返回动态
Giles' blog

The GradScaler implosion: how filtered-out NaN gradients became NaN weights

I noticed something odd when I was training some models the other day -- something that went against my understanding of how PyTorch's Automatic Mixed Precision (AMP) training tools worked. In particular, I believed that the GradScaler class filtered out non-finite gradients -- that was based on this comment in the AMP recipe page : # ``scaler.step()`` first unscales the gradients of the optimizer's assigned paramete…