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
chenpangpang
diffusers
Commits
815d8822
Unverified
Commit
815d8822
authored
Aug 19, 2024
by
Wenlong Wu
Committed by
GitHub
Aug 19, 2024
Browse files
Add loading text inversion (#9130)
parent
ba4348d9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
0 deletions
+3
-0
examples/textual_inversion/README.md
examples/textual_inversion/README.md
+3
-0
No files found.
examples/textual_inversion/README.md
View file @
815d8822
...
@@ -109,6 +109,9 @@ import torch
...
@@ -109,6 +109,9 @@ import torch
model_id
=
"path-to-your-trained-model"
model_id
=
"path-to-your-trained-model"
pipe
=
StableDiffusionPipeline
.
from_pretrained
(
model_id
,
torch_dtype
=
torch
.
float16
).
to
(
"cuda"
)
pipe
=
StableDiffusionPipeline
.
from_pretrained
(
model_id
,
torch_dtype
=
torch
.
float16
).
to
(
"cuda"
)
repo_id_embeds
=
"path-to-your-learned-embeds"
pipe
.
load_textual_inversion
(
repo_id_embeds
)
prompt
=
"A <cat-toy> backpack"
prompt
=
"A <cat-toy> backpack"
image
=
pipe
(
prompt
,
num_inference_steps
=
50
,
guidance_scale
=
7.5
).
images
[
0
]
image
=
pipe
(
prompt
,
num_inference_steps
=
50
,
guidance_scale
=
7.5
).
images
[
0
]
...
...
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