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
ac84c2fa
Unverified
Commit
ac84c2fa
authored
Sep 07, 2022
by
Suraj Patil
Committed by
GitHub
Sep 07, 2022
Browse files
[textual-inversion] fix saving embeds (#387)
fix saving embeds
parent
5a38033d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
examples/textual_inversion/textual_inversion.py
examples/textual_inversion/textual_inversion.py
+1
-1
No files found.
examples/textual_inversion/textual_inversion.py
View file @
ac84c2fa
...
...
@@ -564,7 +564,7 @@ def main():
pipeline
.
save_pretrained
(
args
.
output_dir
)
# Also save the newly trained embeddings
learned_embeds
=
accelerator
.
unwrap_model
(
text_encoder
).
get_input_embeddings
().
weight
[
placeholder_token_id
]
learned_embeds_dict
=
{
args
.
placeholder_token
:
learned_embeds
}
learned_embeds_dict
=
{
args
.
placeholder_token
:
learned_embeds
.
detach
().
cpu
()
}
torch
.
save
(
learned_embeds_dict
,
os
.
path
.
join
(
args
.
output_dir
,
"learned_embeds.bin"
))
if
args
.
push_to_hub
:
...
...
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