Skip to content

Fix UniPC dtype handling with float64 default dtype - #1

Closed
lindicaphxag-tech wants to merge 1 commit into
mainfrom
fix/unipc-default-dtype
Closed

lindicaphxag-tech wants to merge 1 commit into
mainfrom
fix/unipc-default-dtype

Conversation

@lindicaphxag-tech

@lindicaphxag-tech lindicaphxag-tech commented Oct 1, 2026 •

Copy link
Copy Markdown
Owner

Validation PR for upstream issue huggingface#14888.

What does this PR do?

UniPC builds the final unit entry of rks with torch.ones((), device=device). That tensor follows the global default dtype, while the other entries follow the scheduler coefficient dtype. Under torch.set_default_dtype(torch.float64), this promotes R to float64 while b remains float32 and torch.linalg.solve(R, b) fails.

This changes both UniP and UniC paths to torch.ones_like(h), keeping the unit coefficient on the same dtype/device as the rest of the scheduler coefficients, and adds a regression test for a float64 global default.

Validation

  • check_code_quality: passed
  • check_repository_consistency: passed
  • dependency, docs, link, missing-test, and secret checks: passed
  • Dedicated GitHub-hosted validation: pytest -q tests/schedulers/test_scheduler_unipc.py passed
  • The fork-only failures in the stock PR workflow are infrastructure-only: upstream fast tests require Hugging Face private AWS runner groups, and size-label expects upstream labels such as size/S that do not exist in the fork.

AI-assisted contribution self-review

AI assistance was used for issue triage, implementation, and validation. I reviewed the complete diff against Diffusers' .ai/skills/self-review rubric and the testing/code-style/numerical-pitfall references.

Blocking issues: none.

Non-blocking issues: none identified.

Dead code: none. Both changes are on the active UniP/UniC scheduler update paths.

Numerical review: h has the same dtype/device provenance as the other rks entries, so ones_like(h) removes the global-default-dtype leak without changing the normal float32 path.

Verdict: READY.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@lindicaphxag-tech

Copy link
Copy Markdown
Owner Author

Closing this fork-local validation PR because the upstream issue is already covered by huggingface#14920. The branch remains available for reference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants