Skip to content

Commit 1081cd0

Browse files
[LCM] Better error message (huggingface#5788)
1 parent 0754e8f commit 1081cd0

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

schedulers/scheduling_lcm.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,12 @@ def set_timesteps(
378378
# LCM Training Steps Schedule
379379
lcm_origin_timesteps = np.asarray(list(range(1, int(original_steps * strength) + 1))) * c - 1
380380
skipping_step = len(lcm_origin_timesteps) // num_inference_steps
381+
382+
if skipping_step < 1:
383+
raise ValueError(
384+
f"The combination of `original_steps x strength`: {original_steps} x {strength} is smaller than `num_inference_steps`: {num_inference_steps}. Make sure to either reduce `num_inference_steps` to a value smaller than {int(original_steps * strength)} or increase `strength` to a value higher than {float(num_inference_steps / original_steps)}."
385+
)
386+
381387
# LCM Inference Steps Schedule
382388
timesteps = lcm_origin_timesteps[::-skipping_step][:num_inference_steps]
383389

0 commit comments

Comments
 (0)