Skip to content

Commit

Permalink
fix sync condition (hpcaitech#6000)
Browse files Browse the repository at this point in the history
  • Loading branch information
TongLi3701 authored Aug 14, 2024
1 parent ed97d3a commit ceb1e26
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions colossalai/booster/plugin/hybrid_parallel_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -1326,8 +1326,10 @@ def execute_pipeline(
)

# run with gradients accumulation
if model.require_grad_sync == False or (
isinstance(optimizer, HybridParallelZeroOptimizer) and optimizer.require_grad_sync == False
if (
model.require_grad_sync == False
or (isinstance(optimizer, HybridParallelZeroOptimizer) and optimizer.require_grad_sync == False)
or not torch.is_grad_enabled()
):
return outputs

Expand Down

0 comments on commit ceb1e26

Please sign in to comment.