Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
renzhc
diffusers_dcu
Commits
14b97549
Unverified
Commit
14b97549
authored
Oct 04, 2022
by
Suraj Patil
Committed by
GitHub
Oct 04, 2022
Browse files
[train_unconditional] fix applying clip_grad_norm_ (#721)
fix clip_grad_norm_
parent
6b221920
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
1 deletion
+2
-1
examples/unconditional_image_generation/train_unconditional.py
...les/unconditional_image_generation/train_unconditional.py
+2
-1
No files found.
examples/unconditional_image_generation/train_unconditional.py
View file @
14b97549
...
@@ -143,6 +143,7 @@ def main(args):
...
@@ -143,6 +143,7 @@ def main(args):
loss
=
F
.
mse_loss
(
noise_pred
,
noise
)
loss
=
F
.
mse_loss
(
noise_pred
,
noise
)
accelerator
.
backward
(
loss
)
accelerator
.
backward
(
loss
)
if
accelerator
.
sync_gradients
:
accelerator
.
clip_grad_norm_
(
model
.
parameters
(),
1.0
)
accelerator
.
clip_grad_norm_
(
model
.
parameters
(),
1.0
)
optimizer
.
step
()
optimizer
.
step
()
lr_scheduler
.
step
()
lr_scheduler
.
step
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment