You would have to handle MyGroupNorm differently, as this custom modules doesn’t contain the .weight attribute, but instead registers .norm, which has the weight and bias, if affine was set to True.
As a quick fix, you could check, if m.weight is not None and initialize it then.