Skip to content

[mps] Fix float64 upcast in HeliosDMDScheduler.convert_flow_pred_to_x0#14071

Open
Shreyas-jk wants to merge 1 commit into
huggingface:mainfrom
Shreyas-jk:fix-helios-dmd-mps-float64
Open

[mps] Fix float64 upcast in HeliosDMDScheduler.convert_flow_pred_to_x0#14071
Shreyas-jk wants to merge 1 commit into
huggingface:mainfrom
Shreyas-jk:fix-helios-dmd-mps-float64

Conversation

@Shreyas-jk

Copy link
Copy Markdown

What does this PR do?

HeliosDMDScheduler.convert_flow_pred_to_x0 upcasts its tensors to float64 via
.double() for higher-precision math. The MPS backend has no float64, so this
raises Cannot convert a MPS Tensor to float64 dtype as the MPS framework doesn't support float64 on Apple Silicon the moment step() calls it.

The fix mirrors the existing # mps does not support float64 pattern already
used across the schedulers (e.g. scheduling_flow_match_euler_discrete.py):
compute in float32 on mps, keep float64 on CUDA/CPU. Off-MPS numerics are
unchanged. Same fix shape as #13701.

Testing

Verified locally on Apple Silicon (MPS available):

  • New regression test in tests/schedulers/test_scheduler_helios_dmd.py fails
    on the unpatched method with the float64 TypeError, and passes with the fix
    (red → green).
  • make style && make quality clean.
  • pytest tests/schedulers/ -k "flow or helios" → 16 passed.

The test is gated with @unittest.skipUnless(torch_device == "mps", ...), so it
skips on the Linux/CUDA CI runners and runs for contributors on Apple Silicon.

cc @yiyixuxu @sayakpaul

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added size/S PR with diff < 50 LOC tests schedulers and removed size/S PR with diff < 50 LOC labels Jun 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Hi @Shreyas-jk, 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. Fixes #1234) to the PR description so the issue is linked. See the contribution guide for more details. If this PR intentionally does not fix a tracked issue, a maintainer can add the no-issue-needed label to silence this reminder.

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.

1 participant