Skip to content

Commit c727b46

Browse files
committed
Format
Add missing variables
1 parent 2e1278f commit c727b46

File tree

4 files changed

+14
-12
lines changed

4 files changed

+14
-12
lines changed

src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_img2img.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ def __call__(
170170

171171
# set timesteps
172172
self.scheduler.set_timesteps(num_inference_steps)
173+
offset = 1
173174

174175
if not isinstance(init_image, torch.FloatTensor):
175176
init_image = preprocess(init_image)

src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_inpaint.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ def __call__(
193193

194194
# set timesteps
195195
self.scheduler.set_timesteps(num_inference_steps)
196+
offset = 1
196197

197198
# preprocess image
198199
init_image = preprocess_image(init_image).to(self.device)

src/diffusers/schedulers/scheduling_ddim.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
# and https://github.com/hojonathanho/diffusion
1717

1818
import math
19-
from typing import Optional, Tuple, Union
2019
import warnings
20+
from typing import Optional, Tuple, Union
2121

2222
import numpy as np
2323
import torch
@@ -79,12 +79,12 @@ class DDIMScheduler(SchedulerMixin, ConfigMixin):
7979
clip_sample (`bool`, default `True`):
8080
option to clip predicted sample between -1 and 1 for numerical stability.
8181
set_alpha_to_one (`bool`, default `True`):
82-
each diffusion step uses the value of alphas product at that step and at the previous one.
83-
For the final step there is no previous alpha. When this option is `True` the previous alpha
84-
product is fixed to `1`, otherwise it uses the value of alpha at step 0.
82+
each diffusion step uses the value of alphas product at that step and at the previous one. For the final
83+
step there is no previous alpha. When this option is `True` the previous alpha product is fixed to `1`,
84+
otherwise it uses the value of alpha at step 0.
8585
steps_offset (`int`, default `0`):
86-
an offset added to the inference steps. You can use a combination of `offset=1` and `set_alpha_to_one=False`,
87-
to make the last step use step 0 for the previous alpha product.
86+
an offset added to the inference steps. You can use a combination of `offset=1` and
87+
`set_alpha_to_one=False`, to make the last step use step 0 for the previous alpha product.
8888
tensor_format (`str`): whether the scheduler expects pytorch or numpy arrays.
8989
9090
"""

src/diffusers/schedulers/scheduling_pndm.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
# DISCLAIMER: This file is strongly influenced by https://github.com/ermongroup/ddim
1616

1717
import math
18-
from typing import Optional, Tuple, Union
1918
import warnings
19+
from typing import Optional, Tuple, Union
2020

2121
import numpy as np
2222
import torch
@@ -78,12 +78,12 @@ class PNDMScheduler(SchedulerMixin, ConfigMixin):
7878
allows the scheduler to skip the Runge-Kutta steps that are defined in the original paper as being required
7979
before plms steps; defaults to `False`.
8080
set_alpha_to_one (`bool`, default `True`):
81-
each diffusion step uses the value of alphas product at that step and at the previous one.
82-
For the final step there is no previous alpha. When this option is `True` the previous alpha
83-
product is fixed to `1`, otherwise it uses the value of alpha at step 0.
81+
each diffusion step uses the value of alphas product at that step and at the previous one. For the final
82+
step there is no previous alpha. When this option is `True` the previous alpha product is fixed to `1`,
83+
otherwise it uses the value of alpha at step 0.
8484
steps_offset (`int`, default `0`):
85-
an offset added to the inference steps. You can use a combination of `offset=1` and `set_alpha_to_one=False`,
86-
to make the last step use step 0 for the previous alpha product.
85+
an offset added to the inference steps. You can use a combination of `offset=1` and
86+
`set_alpha_to_one=False`, to make the last step use step 0 for the previous alpha product.
8787
tensor_format (`str`): whether the scheduler expects pytorch or numpy arrays
8888
8989
"""

0 commit comments

Comments
 (0)