Fix post_init() code duplication (#36727)

* Update modeling_utils.py

* CIs
This commit is contained in:
Cyril Vallez 2025-03-14 17:36:02 +01:00 committed by GitHub
parent 25992b493c
commit 2c2495cc7b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1917,9 +1917,6 @@ class PreTrainedModel(nn.Module, ModuleUtilsMixin, GenerationMixin, PushToHubMix
for name, module in self.named_children():
if plan := getattr(module, "_tp_plan", None):
self._tp_plan.update({f"{name}.{k}": v for k, v in plan.items()})
for name, module in self.named_children():
if plan := getattr(module, "_tp_plan", None):
self._tp_plan.update({f"{name}.{k}": v for k, v in plan.items()})
if self._tp_plan is not None and is_torch_greater_or_equal("2.3"):
for _, v in self._tp_plan.items():