Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
diffusers
Commits
3ddc2b73
Unverified
Commit
3ddc2b73
authored
Jun 15, 2023
by
Will Berman
Committed by
GitHub
Jun 16, 2023
Browse files
[train text to image] add note to loading from checkpoint (#3806)
add note to loading from checkpoint
parent
d49e2dd5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
0 deletions
+15
-0
examples/text_to_image/README.md
examples/text_to_image/README.md
+15
-0
No files found.
examples/text_to_image/README.md
View file @
3ddc2b73
...
...
@@ -111,6 +111,21 @@ image = pipe(prompt="yoda").images[0]
image
.
save
(
"yoda-pokemon.png"
)
```
Checkpoints only save the unet, so to run inference from a checkpoint, just load the unet
```
python
from
diffusers
import
StableDiffusionPipeline
,
UNet2DConditionModel
model_path
=
"path_to_saved_model"
unet
=
UNet2DConditionModel
.
from_pretrained
(
model_path
+
"/checkpoint-<N>/unet"
)
pipe
=
StableDiffusionPipeline
.
from_pretrained
(
"<initial model>"
,
unet
=
unet
,
torch_dtype
=
torch
.
float16
)
pipe
.
to
(
"cuda"
)
image
=
pipe
(
prompt
=
"yoda"
).
images
[
0
]
image
.
save
(
"yoda-pokemon.png"
)
```
#### Training with multiple GPUs
`accelerate`
allows for seamless multi-GPU training. Follow the instructions
[
here
](
https://huggingface.co/docs/accelerate/basic_tutorials/launch
)
...
...
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