Skip to content

Commit 647658b

Browse files
committed
clip_sample
1 parent 6928f03 commit 647658b

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src/diffusers/schedulers/schedules/beta_schedule.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,6 @@ def __init__(
104104
timestep_spacing: str = "linspace",
105105
timestep_type: str = "discrete", # can be "discrete" or "continuous"
106106
steps_offset: int = 0,
107-
clip_sample: Optional[bool] = False,
108-
clip_sample_range: float = 1.0,
109107
sigma_min: Optional[float] = None,
110108
sigma_max: Optional[float] = None,
111109
final_sigmas_type: str = "zero", # can be "zero" or "sigma_min"
@@ -145,8 +143,6 @@ def __init__(
145143
self.timestep_spacing = timestep_spacing
146144
self.timestep_type = timestep_type
147145
self.steps_offset = steps_offset
148-
self.clip_sample = clip_sample
149-
self.clip_sample_range = clip_sample_range
150146
self.sigma_min = sigma_min
151147
self.sigma_max = sigma_max
152148
self.final_sigmas_type = final_sigmas_type

src/diffusers/schedulers/scheduling_heun_discrete.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ def __init__(
8585
schedule_config,
8686
sigma_schedule_config,
8787
prediction_type: str = "epsilon",
88+
clip_sample: Optional[bool] = False,
89+
clip_sample_range: float = 1.0,
8890
):
8991
self.set_schedule(schedule_config)
9092
self.set_sigma_schedule(sigma_schedule_config)
@@ -264,9 +266,9 @@ def step(
264266
f"prediction_type given as {self.config.prediction_type} must be one of `epsilon`, or `v_prediction`"
265267
)
266268

267-
if self._schedule.clip_sample:
269+
if self.config.clip_sample:
268270
pred_original_sample = pred_original_sample.clamp(
269-
-self._schedule.clip_sample_range, self._schedule.clip_sample_range
271+
-self.config.clip_sample_range, self.config.clip_sample_range
270272
)
271273

272274
if self.state_in_first_order:

0 commit comments

Comments
 (0)