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
ca980fd0
Unverified
Commit
ca980fd0
authored
Feb 16, 2023
by
Patrick von Platen
Committed by
GitHub
Feb 16, 2023
Browse files
[Examples] Make sure EMA works with any device (#2382)
* Fix EMA * up * update
parent
a60f5555
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
0 deletions
+1
-0
examples/text_to_image/train_text_to_image.py
examples/text_to_image/train_text_to_image.py
+1
-0
No files found.
examples/text_to_image/train_text_to_image.py
View file @
ca980fd0
...
...
@@ -438,6 +438,7 @@ def main():
if
args
.
use_ema
:
load_model
=
EMAModel
.
from_pretrained
(
os
.
path
.
join
(
input_dir
,
"unet_ema"
),
UNet2DConditionModel
)
ema_unet
.
load_state_dict
(
load_model
.
state_dict
())
ema_unet
.
to
(
accelerator
.
device
)
del
load_model
for
i
in
range
(
len
(
models
)):
...
...
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