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
OpenDAS
diffusers
Commits
7ec721c5
Unverified
Commit
7ec721c5
authored
Jun 06, 2022
by
Patrick von Platen
Committed by
GitHub
Jun 06, 2022
Browse files
Update README.md
parent
20c2ab02
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
+11
-2
README.md
README.md
+11
-2
No files found.
README.md
View file @
7ec721c5
...
...
@@ -67,10 +67,13 @@ for t in reversed(range(len(scheduler))):
sampled_prev_image
=
prev_image
+
prev_variance
image
=
sampled_prev_image
# process image to PIL
image_processed
=
image
.
cpu
().
permute
(
0
,
2
,
3
,
1
)
image_processed
=
(
image_processed
+
1.0
)
*
127.5
image_processed
=
image_processed
.
numpy
().
astype
(
np
.
uint8
)
image_pil
=
PIL
.
Image
.
fromarray
(
image_processed
[
0
])
# save image
image_pil
.
save
(
"test.png"
)
```
...
...
@@ -81,16 +84,22 @@ Example:
```
python
from
modeling_ddpm
import
DDPM
import
PIL.Image
import
numpy
as
np
# load model and scheduler
ddpm
=
DDPM
.
from_pretrained
(
"fusing/ddpm-lsun-bedroom-pipe"
)
# run pipeline in inference (sample random noise and denoise)
image
=
ddpm
()
import
PIL.Image
import
numpy
as
np
# process image to PIL
image_processed
=
image
.
cpu
().
permute
(
0
,
2
,
3
,
1
)
image_processed
=
(
image_processed
+
1.0
)
*
127.5
image_processed
=
image_processed
.
numpy
().
astype
(
np
.
uint8
)
image_pil
=
PIL
.
Image
.
fromarray
(
image_processed
[
0
])
# save image
image_pil
.
save
(
"test.png"
)
```
...
...
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