Skip to content

Commit

Permalink
Fin
Browse files Browse the repository at this point in the history
  • Loading branch information
muellerzr committed Sep 13, 2023
1 parent d484988 commit fd35a7a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/accelerate/utils/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from ..state import PartialState
from .constants import TORCH_DISTRIBUTED_OPERATION_TYPES
from .dataclasses import DistributedType, TensorInformation
from .imports import is_torch_distributed_available, is_tpu_available
from .imports import is_torch_distributed_available, is_torch_version, is_tpu_available


if is_tpu_available(check_device=False):
Expand Down Expand Up @@ -296,7 +296,10 @@ def _gpu_gather_one(tensor):
dtype=tensor.dtype,
device=state.device,
)
torch.distributed.all_gather_into_tensor(output_tensors, tensor)
if is_torch_version(">=", "1.13"):
torch.distributed.all_gather_into_tensor(output_tensors, tensor)
else:
torch.distributed._all_gather_base(output_tensors, tensor)
return output_tensors.view(-1, *tensor.size()[1:])
else:
# gloo does not support `all_gather_into_tensor`, which will result
Expand Down

0 comments on commit fd35a7a

Please sign in to comment.