Skip to content

Commit

Permalink
grad_wei can't be NoneType when running with DeepSpeed, for zero3 wil…
Browse files Browse the repository at this point in the history
…l divided the gradient
  • Loading branch information
ys950902 committed Jul 22, 2024
1 parent fc989b8 commit 59b511a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion megatron/core/tensor_parallel/layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ def backward(ctx, grad_output):
# grad_weight = grad_output.t().matmul(total_input)
from megatron.core.tensor_parallel.weight_grad_store import WeightGradStore
WeightGradStore.put(total_input, grad_output, weight, gradientUpdateFunction)
grad_weight = None
grad_weight = weight.grad
grad_bias = grad_output.sum(dim=0) if use_bias else None

if ctx.sequence_parallel:
Expand Down

0 comments on commit 59b511a

Please sign in to comment.