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
6e099e2c
Unverified
Commit
6e099e2c
authored
Oct 25, 2022
by
Tanishq Abraham
Committed by
GitHub
Oct 25, 2022
Browse files
add num_inference_steps arg to DDPM (#935)
parent
82044153
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
src/diffusers/pipelines/ddpm/pipeline_ddpm.py
src/diffusers/pipelines/ddpm/pipeline_ddpm.py
+5
-1
No files found.
src/diffusers/pipelines/ddpm/pipeline_ddpm.py
View file @
6e099e2c
...
...
@@ -42,6 +42,7 @@ class DDPMPipeline(DiffusionPipeline):
self
,
batch_size
:
int
=
1
,
generator
:
Optional
[
torch
.
Generator
]
=
None
,
num_inference_steps
:
int
=
1000
,
output_type
:
Optional
[
str
]
=
"pil"
,
return_dict
:
bool
=
True
,
**
kwargs
,
...
...
@@ -53,6 +54,9 @@ class DDPMPipeline(DiffusionPipeline):
generator (`torch.Generator`, *optional*):
A [torch generator](https://pytorch.org/docs/stable/generated/torch.Generator.html) to make generation
deterministic.
num_inference_steps (`int`, *optional*, defaults to 1000):
The number of denoising steps. More denoising steps usually lead to a higher quality image at the
expense of slower inference.
output_type (`str`, *optional*, defaults to `"pil"`):
The output format of the generate image. Choose between
[PIL](https://pillow.readthedocs.io/en/stable/): `PIL.Image.Image` or `np.array`.
...
...
@@ -73,7 +77,7 @@ class DDPMPipeline(DiffusionPipeline):
image
=
image
.
to
(
self
.
device
)
# set step values
self
.
scheduler
.
set_timesteps
(
1000
)
self
.
scheduler
.
set_timesteps
(
num_inference_steps
)
for
t
in
self
.
progress_bar
(
self
.
scheduler
.
timesteps
):
# 1. predict noise model_output
...
...
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