Align TP check (#38328)

align tp check
This commit is contained in:
Marc Sun 2025-05-30 17:15:39 +02:00 committed by GitHub
parent e0545ef0b8
commit 051a8acc9a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2084,7 +2084,7 @@ class PreTrainedModel(nn.Module, ModuleUtilsMixin, PushToHubMixin, PeftAdapterMi
if plan := getattr(module, "_tp_plan", None):
self._tp_plan.update({f"{name}.{k}": v for k, v in plan.copy().items()})
if self._tp_plan is not None and is_torch_greater_or_equal("2.5"):
if self._tp_plan is not None and is_torch_greater_or_equal("2.5") and _torch_distributed_available:
for _, v in self._tp_plan.items():
if v not in ALL_PARALLEL_STYLES:
raise ValueError(