Add missing Args: entries to scheduler docstrings - #14354
Merged
Conversation
Sixteen scheduler methods had Args: blocks that omitted parameters present in the signature. Adds the missing entries: - noise, on the DPMSolver single/multistep and cosine-multistep update methods (required by the sde-* algorithm types) - mu, on DPMSolverMultistep/Singlestep set_timesteps - device, on CogVideoXDDIM and DDIMInverse set_timesteps - sigma / sigma_next / sigma_before, on the Helios UniPC methods Also corrects the rescale_zero_terminal_snr entry in scheduling_dpm_cogvideox, which documented a `betas` parameter the function does not take (it takes alphas_cumprod). The scheduling_dpmsolver_multistep_inverse change is propagated by make fix-copies, not hand-edited. Documentation only; no behavior change.
Contributor
Author
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
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.
What does this PR do?
Adds the missing
Args:entries reported in #14352 — sixteen scheduler methods had docstrings that omitted parameters present in their signature.noise— the DPMSolver singlestep/multistep and cosine-multistep update methods. Not optional in practice: thesde-*algorithm types doassert noise is not None, so a caller reading only the docstring has no way to learn the parameter exists.mu—DPMSolverMultistepScheduler.set_timestepsandDPMSolverSinglestepScheduler.set_timesteps. The entry also records the precondition (use_dynamic_shifting+time_shift_type="exponential"), since passingmuwithout them trips an assert.device—CogVideoXDDIMScheduler.set_timestepsandDDIMInverseScheduler.set_timesteps. Wording matches the existingdeviceentries elsewhere in the schedulers.sigma/sigma_next/sigma_before— the Helios UniPC methods.Also corrects
rescale_zero_terminal_snrinscheduling_dpm_cogvideox.py, whoseArgs:block documented abetasparameter the function does not take — the signature isrescale_zero_terminal_snr(alphas_cumprod).scheduling_dpmsolver_multistep_inverse.pywas not hand-edited: that method is a# Copied fromofscheduling_dpmsolver_multistep, so the change was propagated withmake fix-copiesper.ai/AGENTS.md.Documentation only — no behavior change.
Fixes #14352
Coordination
#14352 is filed but has not yet been acknowledged by a maintainer, and the contributing guide asks for that acknowledgment first. I'm opening this rather than sitting on finished work, but I'd rather flag that than have it look like the step was skipped — happy to close this and wait if you'd prefer the order kept strictly.
Test commands and output
The AST scan that produced the issue's list — comparing each public method's signature against the parameter names in its
Args:block — returns zero findings acrosssrc/diffusers/schedulers/after this change.Self-review notes
Run against
.ai/review-rules.md.Blocking issues: none.
Non-blocking — deliberately left for review:
rescale_zero_terminal_snr's docstring is wrong beyond theArgs:block (scheduling_dpm_cogvideox.py). The summary says "Rescales betas…" andReturns:says "rescaled betas…", but the function takesalphas_cumprodand returnsalphas_bar. I fixed only theArgs:entry, since Scheduler docstrings omit real parameters (noise,mu,device,sigma*) across 16 functions #14352 is scoped to signature/docstring mismatches and widening the diff past the coordinated scope seemed worse than flagging it. Say the word and I'll fix the summary andReturns:here.Doc-impact suggestion: "
Args:entries must match the signature" isn't currently in.ai/review-rules.md, and the scan used here is small enough to run as a CI check. Raising it as a proposal only —CONTRIBUTING.mdsays.ai/is maintainer-owned, so nothing under it is touched in this PR.Dead code analysis: N/A — no new model, no code paths changed.
Accuracy: every description was traced to its use in the source rather than inferred from the parameter name —
noiseto thesde-dpmsolver++assert,mutoflow_shift = np.exp(mu)and its preceding assert, and the Helios sigmas tosigma_t, sigma_s0 = sigma_next, sigmawith theself.sigmas[step_index]fallback.Verdict: READY — 8 files, +46/−2, documentation only.
Before submitting
self-reviewskill on the diff?noise,mu,device,sigma*) across 16 functions #14352 (not yet acknowledged, see Coordination above)