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
e001fede
Unverified
Commit
e001fede
authored
Oct 13, 2022
by
Anton Lozhkov
Committed by
GitHub
Oct 13, 2022
Browse files
Fix dreambooth loss type with prior_preservation and fp16 (#826)
Fix dreambooth loss type with prior preservation
parent
0a09af2f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
examples/dreambooth/train_dreambooth.py
examples/dreambooth/train_dreambooth.py
+1
-1
No files found.
examples/dreambooth/train_dreambooth.py
View file @
e001fede
...
@@ -544,7 +544,7 @@ def main():
...
@@ -544,7 +544,7 @@ def main():
noise
,
noise_prior
=
torch
.
chunk
(
noise
,
2
,
dim
=
0
)
noise
,
noise_prior
=
torch
.
chunk
(
noise
,
2
,
dim
=
0
)
# Compute instance loss
# Compute instance loss
loss
=
F
.
mse_loss
(
noise_pred
,
noise
,
reduction
=
"none"
).
mean
([
1
,
2
,
3
]).
mean
()
loss
=
F
.
mse_loss
(
noise_pred
.
float
(),
noise
.
float
()
,
reduction
=
"none"
).
mean
([
1
,
2
,
3
]).
mean
()
# Compute prior loss
# Compute prior loss
prior_loss
=
F
.
mse_loss
(
noise_pred_prior
.
float
(),
noise_prior
.
float
(),
reduction
=
"mean"
)
prior_loss
=
F
.
mse_loss
(
noise_pred_prior
.
float
(),
noise_prior
.
float
(),
reduction
=
"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