Unverified Commit 3783f3f4 authored by Nicolas Hug's avatar Nicolas Hug Committed by GitHub
Browse files

Fix reduce_across_processes inconsistent return type (#4733)

parent 9ae833af
...@@ -403,7 +403,9 @@ def store_model_weights(model, checkpoint_path, checkpoint_key="model", strict=T ...@@ -403,7 +403,9 @@ def store_model_weights(model, checkpoint_path, checkpoint_key="model", strict=T
def reduce_across_processes(val): def reduce_across_processes(val):
if not is_dist_avail_and_initialized(): if not is_dist_avail_and_initialized():
return val # nothing to sync, but we still convert to tensor for consistency with the distributed case.
return torch.tensor(val)
t = torch.tensor(val, device="cuda") t = torch.tensor(val, device="cuda")
dist.barrier() dist.barrier()
dist.all_reduce(t) dist.all_reduce(t)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment