Skip to content

Commit 9ea62d1

Browse files
yiyixuxuyiyixuxu
and
yiyixuxu
authored
[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 a326d61 commit 9ea62d1

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"),
@@ -233,7 +233,7 @@ def get_order_list(self, num_inference_steps: int) -> List[int]:
233233
orders = [1, 2, 3] * (steps // 3) + [1, 2]
234234
elif order == 2:
235235
if steps % 2 == 0:
236-
orders = [1, 2] * (steps // 2)
236+
orders = [1, 2] * (steps // 2 - 1) + [1, 1]
237237
else:
238238
orders = [1, 2] * (steps // 2) + [1]
239239
elif order == 1:
@@ -320,7 +320,7 @@ def set_timesteps(self, num_inference_steps: int, device: Union[str, torch.devic
320320

321321
if not self.config.lower_order_final and num_inference_steps % self.config.solver_order != 0:
322322
logger.warn(
323-
"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`."
323+
"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`."
324324
)
325325
self.register_to_config(lower_order_final=True)
326326

0 commit comments

Comments
 (0)