From abf101af1f84078cf8edc7dcab8c2cc1ed72f65f Mon Sep 17 00:00:00 2001 From: Cyril Vallez Date: Tue, 29 Jul 2025 16:15:30 +0200 Subject: [PATCH] Fix version issue in modeling_utils.py (#39759) fix version issue --- src/transformers/modeling_utils.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/transformers/modeling_utils.py b/src/transformers/modeling_utils.py index 9db73955b0..4d21b0a556 100644 --- a/src/transformers/modeling_utils.py +++ b/src/transformers/modeling_utils.py @@ -2881,9 +2881,7 @@ class PreTrainedModel(nn.Module, EmbeddingAccessMixin, ModuleUtilsMixin, PushToH # We cannot use `isinstance` on the RMSNorms or LayerNorms, as they usually are custom modules which change names # between modelings (because they are prefixed with the model name) elif ( - isinstance( - module, (nn.LayerNorm, nn.RMSNorm, nn.GroupNorm, nn.BatchNorm1d, nn.BatchNorm2d, nn.BatchNorm3d) - ) + isinstance(module, (nn.GroupNorm, nn.BatchNorm1d, nn.BatchNorm2d, nn.BatchNorm3d)) or "LayerNorm" in module.__class__.__name__ or "RMSNorm" in module.__class__.__name__ ):