Hello.
The reason that I used .modules() was to exclude normalization layers such as nn.LayerNorm and nn.BatchNorm.
These layers also have parameters named weight and bias but these should be excluded from weight decay.
However, within nn.Sequential, it is impossible to tell the type of layer from their names unless their names have been specified. This is why I use .modules() instead of .named_parameters().