Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ZeRO-1] use bf16 allgather #7043

Merged
merged 1 commit into from
May 20, 2024
Merged
Changes from all 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
7 changes: 1 addition & 6 deletions torch_xla/distributed/zero_redundancy_optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,8 +411,7 @@ def allgather_weights_and_update_full_parameter(self):
if param.grad is not None or (self.use_grad_acc_hook and
hasattr(shard, 'main_grad')):
shard_data = shard.data
if not self.higher_cc_precision:
shard_data = shard_data.to(dtype=param.dtype)
shard_data = shard_data.to(dtype=param.dtype)
if self.coalesce_cc:
sharded_data.append(shard_data)
else:
Expand All @@ -422,8 +421,6 @@ def allgather_weights_and_update_full_parameter(self):
pin_layout=self.pin_layout,
groups=self.sharding_groups,
)
if padded_param.dtype != param.dtype:
padded_param = padded_param.to(dtype=param.dtype)
param.data.copy_(padded_param.data[:param.size(0)])

if self.coalesce_cc:
Expand All @@ -441,8 +438,6 @@ def allgather_weights_and_update_full_parameter(self):
if param.grad is not None or (self.use_grad_acc_hook and
hasattr(shard, 'main_grad')):
padded_param = padded_params[index]
if padded_param.dtype != param.dtype:
padded_param = padded_params[index].to(dtype=param.dtype)
param.data.copy_(padded_param.data[:param.size(0)])
index += 1

Expand Down
Loading