Commit 51906b8
committed
[schedulers] fix RecursionError in CosineDPMSolverMultistepScheduler
`CosineDPMSolverMultistepScheduler.step` initialised `BrownianTreeNoiseSampler`
with `sigma_min`/`sigma_max` from the config, but the sampler is queried with
`self.sigmas[step_index]` values that drift outside those bounds: the
Karras/exponential reconstruction of the endpoints in fp32 lands a few ULPs
off, and `final_sigmas_type="zero"` makes the last `sigmas` entry strictly
below `config.sigma_min`. Out-of-range queries push torchsde into unbounded
recursive interval splitting and trip Python's recursion limit (#13274).
Initialise the sampler with the actual `self.sigmas` extrema instead, matching
the pattern in `scheduling_dpmsolver_sde.py`. Adds a regression test covering
both Karras and exponential schedules with `final_sigmas_type="zero"`.1 parent 8f14cde commit 51906b8
2 files changed
Lines changed: 48 additions & 2 deletions
File tree
- src/diffusers/schedulers
- tests/schedulers
Lines changed: 8 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
653 | 653 | | |
654 | 654 | | |
655 | 655 | | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
656 | 662 | | |
657 | 663 | | |
658 | | - | |
659 | | - | |
| 664 | + | |
| 665 | + | |
660 | 666 | | |
661 | 667 | | |
662 | 668 | | |
| |||
Lines changed: 40 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
0 commit comments