[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
pull/6007/head
pre-commit-ci[bot] 2024-08-13 09:36:22 +00:00 committed by Tong Li
parent a8840a090f
commit 3629b36517
1 changed files with 5 additions and 3 deletions

View File

@ -1326,9 +1326,11 @@ class HybridParallelPlugin(PipelinePluginBase):
)
# run with gradients accumulation
if model.require_grad_sync == False or (
isinstance(optimizer, HybridParallelZeroOptimizer) and optimizer.require_grad_sync == False
) or not torch.is_grad_enabled():
if (
model.require_grad_sync == False
or (isinstance(optimizer, HybridParallelZeroOptimizer) and optimizer.require_grad_sync == False)
or not torch.is_grad_enabled()
):
return outputs
# Synchronize the grads of shared parameters of the model.