Skip to content

Add missing Args: entries to scheduler docstrings - #14354

Merged
stevhliu merged 1 commit into
huggingface:mainfrom
4ktLuffy:docs/scheduler-missing-args
Aug 1, 2026
Merged

Add missing Args: entries to scheduler docstrings#14354
stevhliu merged 1 commit into
huggingface:mainfrom
4ktLuffy:docs/scheduler-missing-args

Conversation

@4ktLuffy

@4ktLuffy 4ktLuffy commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

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: the sde-* algorithm types do assert noise is not None, so a caller reading only the docstring has no way to learn the parameter exists.
  • muDPMSolverMultistepScheduler.set_timesteps and DPMSolverSinglestepScheduler.set_timesteps. The entry also records the precondition (use_dynamic_shifting + time_shift_type="exponential"), since passing mu without them trips an assert.
  • deviceCogVideoXDDIMScheduler.set_timesteps and DDIMInverseScheduler.set_timesteps. Wording matches the existing device entries elsewhere in the schedulers.
  • sigma / sigma_next / sigma_before — the Helios UniPC methods.

Also corrects rescale_zero_terminal_snr in scheduling_dpm_cogvideox.py, whose Args: block documented a betas parameter the function does not take — the signature is rescale_zero_terminal_snr(alphas_cumprod).

scheduling_dpmsolver_multistep_inverse.py was not hand-edited: that method is a # Copied from of scheduling_dpmsolver_multistep, so the change was propagated with make fix-copies per .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

$ make quality
ruff check examples scripts src tests utils benchmarks setup.py
All checks passed!
ruff format --check examples scripts src tests utils benchmarks setup.py
2000 files already formatted
doc-builder style src/diffusers docs/source --max_len 119 --check_only
python utils/check_doc_toc.py
$ python -m pytest tests/schedulers/test_scheduler_dpm_multi.py \
    tests/schedulers/test_scheduler_dpm_single.py \
    tests/schedulers/test_scheduler_dpm_multi_inverse.py \
    tests/schedulers/test_scheduler_ddim_inverse.py -q

151 passed, 3 skipped, 24805 warnings in 59.18s

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 across src/diffusers/schedulers/ after this change.

Self-review notes

Run against .ai/review-rules.md.

Blocking issues: none.

Non-blocking — deliberately left for review:

  1. rescale_zero_terminal_snr's docstring is wrong beyond the Args: block (scheduling_dpm_cogvideox.py). The summary says "Rescales betas…" and Returns: says "rescaled betas…", but the function takes alphas_cumprod and returns alphas_bar. I fixed only the Args: 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 and Returns: here.

  2. 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.md says .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 — noise to the sde-dpmsolver++ assert, mu to flow_shift = np.exp(mu) and its preceding assert, and the Helios sigmas to sigma_t, sigma_s0 = sigma_next, sigma with the self.sigmas[step_index] fallback.

Verdict: READY — 8 files, +46/−2, documentation only.

Before submitting

  • Did you use an AI agent (Claude Code, Codex, Cursor, etc.) to help with this PR? If so:
    • Did you read the Coding with AI agents guide?
    • Did you run the self-review skill on the diff?
    • Did you share the final self-review notes in the PR description or a comment?
  • Did you read the contributor guideline?
  • Did you read our philosophy doc? (important for complex PRs)
  • Was this discussed/approved via a GitHub issue or the forum? Please add a link to it if that's the case. — discussed in Scheduler docstrings omit real parameters (noise, mu, device, sigma*) across 16 functions #14352 (not yet acknowledged, see Coordination above)
  • Did you make sure to update the documentation with your changes?
  • Did you write any new necessary tests? — none needed; documentation only
  • Are you the author (or part of the team) of the model/pipeline (only applicable for model/pipeline related PRs)?

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.
@github-actions github-actions Bot added fixes-issue size/S PR with diff < 50 LOC schedulers labels Aug 1, 2026
@4ktLuffy

4ktLuffy commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

Tagging for review — @stevhliu (docs; git blame shows most of the DPMSolver docstring bodies here are yours) and @dg845 (schedulers; the scheduling_helios.py docstrings are yours).

Documentation only, +46/-2, no behavior change. Self-review notes are in the PR description.

@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

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.

@stevhliu stevhliu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@stevhliu
stevhliu merged commit 4b8e466 into huggingface:main Aug 1, 2026
14 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Scheduler docstrings omit real parameters (noise, mu, device, sigma*) across 16 functions

3 participants