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

Fix: Sparse tensors not updating #1914

Merged
merged 9 commits into from
May 23, 2022
3 changes: 2 additions & 1 deletion deepspeed/runtime/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -2169,7 +2169,8 @@ def _get_gradients_for_reduction(self):

grad_data = param.grad.data
if param_name in self.sparse_tensor_module_names or grad_data.is_sparse:
grad_data = SparseTensor(grad_data)
# Call param.grad without data to avoid problem with setting of updated grads
grad_data = SparseTensor(param.grad)

if is_moe_param(param):
expert_grads[param.group_name].append(grad_data)
Expand Down