[mps] Fix float64 upcast in HeliosDMDScheduler.convert_flow_pred_to_x0#14071
Open
Shreyas-jk wants to merge 1 commit into
Open
[mps] Fix float64 upcast in HeliosDMDScheduler.convert_flow_pred_to_x0#14071Shreyas-jk wants to merge 1 commit into
Shreyas-jk wants to merge 1 commit into
Conversation
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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. |
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?
HeliosDMDScheduler.convert_flow_pred_to_x0upcasts its tensors to float64 via.double()for higher-precision math. The MPS backend has no float64, so thisraises
Cannot convert a MPS Tensor to float64 dtype as the MPS framework doesn't support float64on Apple Silicon the momentstep()calls it.The fix mirrors the existing
# mps does not support float64pattern alreadyused across the schedulers (e.g.
scheduling_flow_match_euler_discrete.py):compute in float32 on
mps, keep float64 on CUDA/CPU. Off-MPS numerics areunchanged. Same fix shape as #13701.
Testing
Verified locally on Apple Silicon (MPS available):
tests/schedulers/test_scheduler_helios_dmd.pyfailson the unpatched method with the float64
TypeError, and passes with the fix(red → green).
make style && make qualityclean.pytest tests/schedulers/ -k "flow or helios"→ 16 passed.The test is gated with
@unittest.skipUnless(torch_device == "mps", ...), so itskips on the Linux/CUDA CI runners and runs for contributors on Apple Silicon.
cc @yiyixuxu @sayakpaul