Skip to content

Commit

Permalink
check if distributed used before world check
Browse files Browse the repository at this point in the history
  • Loading branch information
drewnutt committed Jul 22, 2024
1 parent 6410210 commit 3ef67ae
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion python/torch_bindings.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ def __iter__(self):
worker_id = worker_info.id if worker_info is not None else 0
n_workers = worker_info.num_workers if worker_info is not None else 1

world_size = get_world_size()
world_size = get_world_size() if torch.distributed.is_initialized() else 1
if world_size == 1:
return islice(self.generate(), worker_id, None, n_workers)
process_rank = get_rank()
Expand Down

0 comments on commit 3ef67ae

Please sign in to comment.