fix: correct MPS execution on apple silicon#145
Merged
yanghan234 merged 11 commits intomainfrom Apr 22, 2026
Merged
Conversation
450d7cf to
191cf36
Compare
Collaborator
Author
|
@copilot resolve the merge conflicts in this pull request |
Contributor
Resolved the merge conflicts by merging |
Add conftest.py with a device fixture that auto-detects available torch devices. Tests using the fixture run on all available backends. A --device flag allows restricting to a single device. Converted test_batch_relax.py from unittest to pytest style to use the device fixture. Verified passing on both cpu and mps. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- M3Gnet.forward now uses .get() with fallback computation for precomputed keys (total_num_atoms, bond_index_bias, etc.), so callers constructing input dicts directly won't KeyError. - batch_to_dict creates index_map on CPU (moved to device at the end), avoiding intermediate device mismatches. - Remove unused pytest import in test_batch_relax.py. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Prevents device mismatch if graph_batch tensors are already on a non-CPU device when batch_to_dict is called. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add total_num_atoms, total_num_bonds, bond_index_bias, and three_body_edge_map to TENSOR_KEYS. Handle int values in device assertions. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
93a63fb to
578d379
Compare
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
Summary
SphericalBasisLayer.coefas a buffer so it moves with the model on MPSbatch_to_dict()and move the input dict to the target deviceexplicitly