Skip to content

Commit da99063

Browse files
author
Nathan Lambert
authored
Scheduler docs update (#464)
* update scheduler docs TODOs, fix typos * fix another typo
1 parent e335f05 commit da99063

File tree

7 files changed

+20
-18
lines changed

7 files changed

+20
-18
lines changed

src/diffusers/schedulers/scheduling_ddim.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class DDIMScheduler(SchedulerMixin, ConfigMixin):
6262
[`~ConfigMixin`] takes care of storing all config attributes that are passed in the scheduler's `__init__`
6363
function, such as `num_train_timesteps`. They can be accessed via `scheduler.config.num_train_timesteps`.
6464
[`~ConfigMixin`] also provides general loading and saving functionality via the [`~ConfigMixin.save_config`] and
65-
[`~ConfigMixin.from_config`] functios.
65+
[`~ConfigMixin.from_config`] functions.
6666
6767
For more details, see the original paper: https://arxiv.org/abs/2010.02502
6868
@@ -73,8 +73,8 @@ class DDIMScheduler(SchedulerMixin, ConfigMixin):
7373
beta_schedule (`str`):
7474
the beta schedule, a mapping from a beta range to a sequence of betas for stepping the model. Choose from
7575
`linear`, `scaled_linear`, or `squaredcos_cap_v2`.
76-
trained_betas (`np.ndarray`, optional): TODO
77-
timestep_values (`np.ndarray`, optional): TODO
76+
trained_betas (`np.ndarray`, optional):
77+
option to pass an array of betas directly to the constructor to bypass `beta_start`, `beta_end` etc.
7878
clip_sample (`bool`, default `True`):
7979
option to clip predicted sample between -1 and 1 for numerical stability.
8080
set_alpha_to_one (`bool`, default `True`):
@@ -91,7 +91,6 @@ def __init__(
9191
beta_end: float = 0.02,
9292
beta_schedule: str = "linear",
9393
trained_betas: Optional[np.ndarray] = None,
94-
timestep_values: Optional[np.ndarray] = None,
9594
clip_sample: bool = True,
9695
set_alpha_to_one: bool = True,
9796
tensor_format: str = "pt",
@@ -142,7 +141,8 @@ def set_timesteps(self, num_inference_steps: int, offset: int = 0):
142141
Args:
143142
num_inference_steps (`int`):
144143
the number of diffusion steps used when generating samples with a pre-trained model.
145-
offset (`int`): TODO
144+
offset (`int`):
145+
optional value to shift timestep values up by. A value of 1 is used in stable diffusion for inference.
146146
"""
147147
self.num_inference_steps = num_inference_steps
148148
self.timesteps = np.arange(

src/diffusers/schedulers/scheduling_ddpm.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class DDPMScheduler(SchedulerMixin, ConfigMixin):
6161
[`~ConfigMixin`] takes care of storing all config attributes that are passed in the scheduler's `__init__`
6262
function, such as `num_train_timesteps`. They can be accessed via `scheduler.config.num_train_timesteps`.
6363
[`~ConfigMixin`] also provides general loading and saving functionality via the [`~ConfigMixin.save_config`] and
64-
[`~ConfigMixin.from_config`] functios.
64+
[`~ConfigMixin.from_config`] functions.
6565
6666
For more details, see the original paper: https://arxiv.org/abs/2006.11239
6767
@@ -72,7 +72,8 @@ class DDPMScheduler(SchedulerMixin, ConfigMixin):
7272
beta_schedule (`str`):
7373
the beta schedule, a mapping from a beta range to a sequence of betas for stepping the model. Choose from
7474
`linear`, `scaled_linear`, or `squaredcos_cap_v2`.
75-
trained_betas (`np.ndarray`, optional): TODO
75+
trained_betas (`np.ndarray`, optional):
76+
option to pass an array of betas directly to the constructor to bypass `beta_start`, `beta_end` etc.
7677
variance_type (`str`):
7778
options to clip the variance used when adding noise to the denoised sample. Choose from `fixed_small`,
7879
`fixed_small_log`, `fixed_large`, `fixed_large_log`, `learned` or `learned_range`.

src/diffusers/schedulers/scheduling_karras_ve.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class KarrasVeScheduler(SchedulerMixin, ConfigMixin):
5353
[`~ConfigMixin`] takes care of storing all config attributes that are passed in the scheduler's `__init__`
5454
function, such as `num_train_timesteps`. They can be accessed via `scheduler.config.num_train_timesteps`.
5555
[`~ConfigMixin`] also provides general loading and saving functionality via the [`~ConfigMixin.save_config`] and
56-
[`~ConfigMixin.from_config`] functios.
56+
[`~ConfigMixin.from_config`] functions.
5757
5858
For more details on the parameters, see the original paper's Appendix E.: "Elucidating the Design Space of
5959
Diffusion-Based Generative Models." https://arxiv.org/abs/2206.00364. The grid search values used to find the

src/diffusers/schedulers/scheduling_lms_discrete.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class LMSDiscreteScheduler(SchedulerMixin, ConfigMixin):
3232
[`~ConfigMixin`] takes care of storing all config attributes that are passed in the scheduler's `__init__`
3333
function, such as `num_train_timesteps`. They can be accessed via `scheduler.config.num_train_timesteps`.
3434
[`~ConfigMixin`] also provides general loading and saving functionality via the [`~ConfigMixin.save_config`] and
35-
[`~ConfigMixin.from_config`] functios.
35+
[`~ConfigMixin.from_config`] functions.
3636
3737
Args:
3838
num_train_timesteps (`int`): number of diffusion steps used to train the model.
@@ -41,10 +41,10 @@ class LMSDiscreteScheduler(SchedulerMixin, ConfigMixin):
4141
beta_schedule (`str`):
4242
the beta schedule, a mapping from a beta range to a sequence of betas for stepping the model. Choose from
4343
`linear` or `scaled_linear`.
44-
trained_betas (`np.ndarray`, optional): TODO
44+
trained_betas (`np.ndarray`, optional):
45+
option to pass an array of betas directly to the constructor to bypass `beta_start`, `beta_end` etc.
4546
options to clip the variance used when adding noise to the denoised sample. Choose from `fixed_small`,
4647
`fixed_small_log`, `fixed_large`, `fixed_large_log`, `learned` or `learned_range`.
47-
timestep_values (`np.ndarry`, optional): TODO
4848
tensor_format (`str`): whether the scheduler expects pytorch or numpy arrays.
4949
5050
"""
@@ -57,7 +57,6 @@ def __init__(
5757
beta_end: float = 0.02,
5858
beta_schedule: str = "linear",
5959
trained_betas: Optional[np.ndarray] = None,
60-
timestep_values: Optional[np.ndarray] = None,
6160
tensor_format: str = "pt",
6261
):
6362
if trained_betas is not None:

src/diffusers/schedulers/scheduling_pndm.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class PNDMScheduler(SchedulerMixin, ConfigMixin):
6161
[`~ConfigMixin`] takes care of storing all config attributes that are passed in the scheduler's `__init__`
6262
function, such as `num_train_timesteps`. They can be accessed via `scheduler.config.num_train_timesteps`.
6363
[`~ConfigMixin`] also provides general loading and saving functionality via the [`~ConfigMixin.save_config`] and
64-
[`~ConfigMixin.from_config`] functios.
64+
[`~ConfigMixin.from_config`] functions.
6565
6666
For more details, see the original paper: https://arxiv.org/abs/2202.09778
6767
@@ -72,7 +72,8 @@ class PNDMScheduler(SchedulerMixin, ConfigMixin):
7272
beta_schedule (`str`):
7373
the beta schedule, a mapping from a beta range to a sequence of betas for stepping the model. Choose from
7474
`linear`, `scaled_linear`, or `squaredcos_cap_v2`.
75-
trained_betas (`np.ndarray`, optional): TODO
75+
trained_betas (`np.ndarray`, optional):
76+
option to pass an array of betas directly to the constructor to bypass `beta_start`, `beta_end` etc.
7677
tensor_format (`str`): whether the scheduler expects pytorch or numpy arrays
7778
skip_prk_steps (`bool`):
7879
allows the scheduler to skip the Runge-Kutta steps that are defined in the original paper as being required
@@ -138,7 +139,8 @@ def set_timesteps(self, num_inference_steps: int, offset: int = 0) -> torch.Floa
138139
Args:
139140
num_inference_steps (`int`):
140141
the number of diffusion steps used when generating samples with a pre-trained model.
141-
offset (`int`): TODO
142+
offset (`int`):
143+
optional value to shift timestep values up by. A value of 1 is used in stable diffusion for inference.
142144
"""
143145
self.num_inference_steps = num_inference_steps
144146
self._timesteps = list(

src/diffusers/schedulers/scheduling_sde_ve.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class ScoreSdeVeScheduler(SchedulerMixin, ConfigMixin):
5252
[`~ConfigMixin`] takes care of storing all config attributes that are passed in the scheduler's `__init__`
5353
function, such as `num_train_timesteps`. They can be accessed via `scheduler.config.num_train_timesteps`.
5454
[`~ConfigMixin`] also provides general loading and saving functionality via the [`~ConfigMixin.save_config`] and
55-
[`~ConfigMixin.from_config`] functios.
55+
[`~ConfigMixin.from_config`] functions.
5656
5757
Args:
5858
snr (`float`):
@@ -61,7 +61,7 @@ class ScoreSdeVeScheduler(SchedulerMixin, ConfigMixin):
6161
initial noise scale for sigma sequence in sampling procedure. The minimum sigma should mirror the
6262
distribution of the data.
6363
sigma_max (`float`): maximum value used for the range of continuous timesteps passed into the model.
64-
sampling_eps (`float`): the end value of sampling, where timesteps decrease progessively from 1 to
64+
sampling_eps (`float`): the end value of sampling, where timesteps decrease progressively from 1 to
6565
epsilon.
6666
correct_steps (`int`): number of correction steps performed on a produced sample.
6767
tensor_format (`str`): "np" or "pt" for the expected format of samples passed to the Scheduler.

src/diffusers/schedulers/scheduling_sde_vp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class ScoreSdeVpScheduler(SchedulerMixin, ConfigMixin):
3030
[`~ConfigMixin`] takes care of storing all config attributes that are passed in the scheduler's `__init__`
3131
function, such as `num_train_timesteps`. They can be accessed via `scheduler.config.num_train_timesteps`.
3232
[`~ConfigMixin`] also provides general loading and saving functionality via the [`~ConfigMixin.save_config`] and
33-
[`~ConfigMixin.from_config`] functios.
33+
[`~ConfigMixin.from_config`] functions.
3434
3535
For more information, see the original paper: https://arxiv.org/abs/2011.13456
3636

0 commit comments

Comments
 (0)