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
60c384bc
Unverified
Commit
60c384bc
authored
Oct 12, 2022
by
pink-red
Committed by
GitHub
Oct 12, 2022
Browse files
Fix fine-tuning compatibility with deepspeed (#816)
parent
008b608f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
examples/text_to_image/train_text_to_image.py
examples/text_to_image/train_text_to_image.py
+1
-1
No files found.
examples/text_to_image/train_text_to_image.py
View file @
60c384bc
...
@@ -568,7 +568,7 @@ def main():
...
@@ -568,7 +568,7 @@ def main():
# Predict the noise residual and compute loss
# Predict the noise residual and compute loss
noise_pred
=
unet
(
noisy_latents
,
timesteps
,
encoder_hidden_states
).
sample
noise_pred
=
unet
(
noisy_latents
,
timesteps
,
encoder_hidden_states
).
sample
loss
=
F
.
mse_loss
(
noise_pred
,
noise
,
reduction
=
"mean"
)
loss
=
F
.
mse_loss
(
noise_pred
.
float
(),
noise
.
float
()
,
reduction
=
"mean"
)
# Gather the losses across all processes for logging (if we use distributed training).
# Gather the losses across all processes for logging (if we use distributed training).
avg_loss
=
accelerator
.
gather
(
loss
.
repeat
(
args
.
train_batch_size
)).
mean
()
avg_loss
=
accelerator
.
gather
(
loss
.
repeat
(
args
.
train_batch_size
)).
mean
()
...
...
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