Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/transformers/modeling_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
find_pruneable_heads_and_indices,
id_tensor_storage,
is_torch_greater_or_equal_than_1_13,
is_torch_greater_or_equal_than_2_4,
is_torch_greater_or_equal_than_2_5,
prune_conv1d_layer,
prune_layer,
prune_linear_layer,
Expand Down Expand Up @@ -5007,7 +5007,7 @@ def tensor_parallel(self, device_mesh):
device_mesh (`torch.distributed.DeviceMesh`):
The device mesh to use for tensor parallelism.
"""
if not is_torch_greater_or_equal_than_2_4:
if not is_torch_greater_or_equal_than_2_5:
raise EnvironmentError("tensor parallel is only supported for `torch>=2.5`.")

# Tensor parallelize a nn.Module based on the `_tp_plan` attribute of the module.
Expand Down
3 changes: 2 additions & 1 deletion src/transformers/pytorch_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

parsed_torch_version_base = version.parse(version.parse(torch.__version__).base_version)

is_torch_greater_or_equal_than_2_5 = parsed_torch_version_base >= version.parse("2.5")
is_torch_greater_or_equal_than_2_4 = parsed_torch_version_base >= version.parse("2.4")
is_torch_greater_or_equal_than_2_3 = parsed_torch_version_base >= version.parse("2.3")
is_torch_greater_or_equal_than_2_2 = parsed_torch_version_base >= version.parse("2.2")
Expand All @@ -39,7 +40,7 @@
is_torch_greater_or_equal_than_1_12 = parsed_torch_version_base >= version.parse("1.12")


if is_torch_greater_or_equal_than_2_4:
if is_torch_greater_or_equal_than_2_5:
from torch.distributed.tensor import Replicate
from torch.distributed.tensor.parallel import (
ColwiseParallel,
Expand Down