From e04194ce8765bfc360d1c40aba52e3ffd707f47b Mon Sep 17 00:00:00 2001 From: hlky Date: Mon, 23 Sep 2024 23:52:33 +0100 Subject: [PATCH] Apply suggestions from code review Co-authored-by: YiYi Xu --- src/diffusers/schedulers/scheduling_euler_discrete.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/diffusers/schedulers/scheduling_euler_discrete.py b/src/diffusers/schedulers/scheduling_euler_discrete.py index 92ec6adeaf12..4e11f7da3f74 100644 --- a/src/diffusers/schedulers/scheduling_euler_discrete.py +++ b/src/diffusers/schedulers/scheduling_euler_discrete.py @@ -338,6 +338,8 @@ def set_timesteps( raise ValueError("Cannot set `timesteps` with `config.use_karras_sigmas = True`.") if timesteps is not None and self.config.use_exponential_sigmas: raise ValueError("Cannot set `timesteps` with `config.use_exponential_sigmas = True`.") + if self.config.use_exponential_sigmas and self.config.use_karras_sigmas: + raise ValueErrror("Cannot set both `config.use_exponential_sigmas = True` and config.use_karras_sigmas = True`") if ( timesteps is not None and self.config.timestep_type == "continuous" @@ -402,7 +404,7 @@ def set_timesteps( sigmas = self._convert_to_karras(in_sigmas=sigmas, num_inference_steps=self.num_inference_steps) timesteps = np.array([self._sigma_to_t(sigma, log_sigmas) for sigma in sigmas]) - if self.config.use_exponential_sigmas: + elif self.config.use_exponential_sigmas: sigmas = self._convert_to_exponential(in_sigmas=sigmas, num_inference_steps=self.num_inference_steps) timesteps = np.array([self._sigma_to_t(sigma, log_sigmas) for sigma in sigmas])