Skip to content

all_gather_into_tensor is deprecated, _gpu_gather warns on every gather #4269

Description

@qgallouedec

System Info

accelerate 1.15.0, torch 2.13.0+cu129, transformers 5.18.0.dev0, 8 x H100.

Information

  • The official example scripts
  • My own modified scripts

Reproduction

_gpu_gather uses an API torch deprecated, so every Accelerator.gather logs a FutureWarning once per rank:

torch/distributed/c10d_logger.py:83: FutureWarning: `torch.distributed.all_gather_into_tensor` is deprecated.
Please use `torch.distributed.all_gather_single` instead.
# utils/operations.py:324
gather_op = torch.distributed.all_gather_into_tensor

It is reached from any Trainer run, Trainer._get_num_items_in_batch -> Accelerator.gather -> _gpu_gather -> _gpu_gather_one.

Expected behavior

No warning. torch.distributed.all_gather_single exists in torch 2.13, so this can be a rename behind a version check for older torch.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions