fix: Fix RecursionError in CosineDPMSolver Brownian tree noise sampler - #14506
Open
Ricardo-M-L wants to merge 1 commit into
Open
fix: Fix RecursionError in CosineDPMSolver Brownian tree noise sampler#14506Ricardo-M-L wants to merge 1 commit into
Ricardo-M-L wants to merge 1 commit into
Conversation
`CosineDPMSolverMultistepScheduler.step` constructs `BrownianTreeNoiseSampler`
with `sigma_min=self.config.sigma_min` / `sigma_max=self.config.sigma_max`
and then queries it with `(self.sigmas[i], self.sigmas[i+1])`. Two drifts
leave those queries outside the Brownian tree's valid interval:
* The Karras reconstruction of `sigma_max` in fp32 can land a few ULPs
above the config value (e.g. 500 -> 500.00006103515625), so the first
query violates `tb <= t1`.
* With the default `final_sigmas_type="zero"` the last query is
`sigma_next == 0`, which is strictly below `config.sigma_min`, so it
violates `ta >= t0`.
torchsde responds to both by recursively splitting the backing interval
until Python's recursion limit blows up, which surfaces as the
`RecursionError: maximum recursion depth exceeded` reported by stable-audio
users in huggingface#13274.
Use the actual extrema of `self.sigmas` — the same pattern already used by
`scheduling_dpmsolver_sde.py:690` — so the Brownian bounds always enclose
every query issued during sampling.
Fixes huggingface#13274
Contributor
|
Hi @Ricardo-M-L, thanks for the PR! It does not appear to link an issue it fixes. If this PR addresses an existing issue, please add a closing keyword (e.g. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Clean rebase of fix/cosine-dpm-brownian-bounds