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
2894be2a
Unverified
Commit
2894be2a
authored
Jun 02, 2022
by
Patrick von Platen
Committed by
GitHub
Jun 02, 2022
Browse files
Update README.md
parent
6d4879c2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
0 deletions
+23
-0
README.md
README.md
+23
-0
No files found.
README.md
View file @
2894be2a
...
...
@@ -37,3 +37,26 @@
├── tests
│ └── test_modeling_utils.py
```
## Dummy Example
```
python
from
diffusers
import
UNetModel
,
GaussianDiffusion
import
torch
# 1. Load model
unet
=
UNetModel
.
from_pretrained
(
"fusing/ddpm_dummy"
)
# 2. Do one denoising step with model
batch_size
,
num_channels
,
height
,
width
=
1
,
3
,
32
,
32
dummy_noise
=
torch
.
ones
((
batch_size
,
num_channels
,
height
,
width
))
time_step
=
torch
.
tensor
([
10
])
image
=
unet
(
dummy_noise
,
time_step
)
# 3. Load sampler
sampler
=
GaussianDiffusion
.
from_config
(
"fusing/ddpm_dummy"
)
# 4. Sample image from sampler passing the model
image
=
sampler
.
sample
(
model
,
batch_size
=
1
)
print
(
image
)
```
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