Skip to content

Commit c1f2609

Browse files
yiyixuxuyiyixuxu
andcommitted
[DPMSolverSinglestepScheduler] correct get_order_list for solver_order=2and lower_order_final=True (#6953)
* add * change default --------- Co-authored-by: yiyixuxu <yixu310@gmail,com>
1 parent 552634d commit c1f2609

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/diffusers/schedulers/scheduling_dpmsolver_singlestep.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ def __init__(
151151
sample_max_value: float = 1.0,
152152
algorithm_type: str = "dpmsolver++",
153153
solver_type: str = "midpoint",
154-
lower_order_final: bool = True,
154+
lower_order_final: bool = False,
155155
use_karras_sigmas: Optional[bool] = False,
156156
final_sigmas_type: Optional[str] = "zero", # "zero", "sigma_min"
157157
lambda_min_clipped: float = -float("inf"),
@@ -232,7 +232,7 @@ def get_order_list(self, num_inference_steps: int) -> List[int]:
232232
orders = [1, 2, 3] * (steps // 3) + [1, 2]
233233
elif order == 2:
234234
if steps % 2 == 0:
235-
orders = [1, 2] * (steps // 2)
235+
orders = [1, 2] * (steps // 2 - 1) + [1, 1]
236236
else:
237237
orders = [1, 2] * (steps // 2) + [1]
238238
elif order == 1:
@@ -301,7 +301,7 @@ def set_timesteps(self, num_inference_steps: int, device: Union[str, torch.devic
301301

302302
if not self.config.lower_order_final and num_inference_steps % self.config.solver_order != 0:
303303
logger.warn(
304-
"Changing scheduler {self.config} to have `lower_order_final` set to True to handle uneven amount of inference steps. Please make sure to always use an even number of `num_inference steps when using `lower_order_final=True`."
304+
"Changing scheduler {self.config} to have `lower_order_final` set to True to handle uneven amount of inference steps. Please make sure to always use an even number of `num_inference steps when using `lower_order_final=False`."
305305
)
306306
self.register_to_config(lower_order_final=True)
307307

0 commit comments

Comments
 (0)