Commit 75c3d3c
committed
Assert on a missing gradient in the ZenFlow parallel offload copy
ZenFlowZeroOptimizerParallel.async_inplace_copy_grad_to_fp32_buffer_from_gpu
branches on `grad_accum is None` and then calls `.view(-1)` on it in both
branches, so the None branch raises AttributeError instead of handling None.
DeepSpeedZeroOptimizer's own copy of this method asserts the attribute is
present rather than branching. Do the same here: identical behaviour when the
gradient exists, and a clear assertion instead of an AttributeError when it
does not.
Signed-off-by: Vineeth Sai <vineethsai4444@gmail.com>1 parent d4ed1f1 commit 75c3d3c
1 file changed
Lines changed: 3 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
685 | 685 | | |
686 | 686 | | |
687 | 687 | | |
688 | | - | |
689 | | - | |
690 | | - | |
691 | | - | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
692 | 691 | | |
693 | 692 | | |
694 | 693 | | |
| |||
0 commit comments