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
chenpangpang
diffusers
Commits
055ef773
Commit
055ef773
authored
Jun 02, 2022
by
Patrick von Platen
Browse files
Merge branch 'main' of
https://github.com/huggingface/diffusers
parents
c7ba6ba2
2894be2a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
62 additions
and
1 deletion
+62
-1
README.md
README.md
+62
-1
No files found.
README.md
View file @
055ef773
Super cool library about diffusion models
# Diffusers
## Library structure:
```
├── models
│ ├── dalle2
│ │ ├── modeling_dalle2.py
│ │ ├── README.md
│ │ └── run_dalle2.py
│ ├── ddpm
│ │ ├── modeling_ddpm.py
│ │ ├── README.md
│ │ └── run_ddpm.py
│ ├── glide
│ │ ├── modeling_glide.py
│ │ ├── README.md
│ │ └── run_dalle2.py
│ ├── imagen
│ │ ├── modeling_dalle2.py
│ │ ├── README.md
│ │ └── run_dalle2.py
│ └── latent_diffusion
│ ├── modeling_latent_diffusion.py
│ ├── README.md
│ └── run_latent_diffusion.py
├── src
│ └── diffusers
│ ├── configuration_utils.py
│ ├── __init__.py
│ ├── modeling_utils.py
│ ├── models
│ │ └── unet.py
│ ├── processors
│ └── samplers
│ ├── gaussian.py
├── 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