We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6b22192 commit 14b9754Copy full SHA for 14b9754
examples/unconditional_image_generation/train_unconditional.py
@@ -143,7 +143,8 @@ def transforms(examples):
143
loss = F.mse_loss(noise_pred, noise)
144
accelerator.backward(loss)
145
146
- accelerator.clip_grad_norm_(model.parameters(), 1.0)
+ if accelerator.sync_gradients:
147
+ accelerator.clip_grad_norm_(model.parameters(), 1.0)
148
optimizer.step()
149
lr_scheduler.step()
150
if args.use_ema:
0 commit comments