Resolve ewald cache shape issue#110
Conversation
Greptile SummaryThis PR fixes a crash in the Ewald and PME wrappers where
Important Files Changed
Reviews (4): Last reviewed commit: "update tolerances and break up OR statem..." | Re-trigger Greptile |
laserkelvin
left a comment
There was a problem hiding this comment.
In general looks good to me, just have some minor things to discuss
|
|
||
|
|
||
| def cell_cache_needs_update( | ||
| cell: torch.Tensor, |
There was a problem hiding this comment.
Do you mind adding the appropriate jaxtyping shape annotations?
You might need to have them as separate hints to denote that the cached and the incoming cells can be different shapes
There was a problem hiding this comment.
Updated, thanks for the reminder.
Signed-off-by: Ying Shi Teh <yteh@nvidia.com>
Signed-off-by: Ying Shi Teh <yteh@nvidia.com>
Signed-off-by: Ying Shi Teh <yteh@nvidia.com>
62734a6 to
347d601
Compare
Signed-off-by: Ying Shi Teh <yteh@nvidia.com>
|
Thanks, I addressed all the comments including allowing users to change the tolerances when initializing the wrappers. All related tests passed. |
|
/ok to test b0af7b4 |
ALCHEMI Toolkit Pull Request
Description
The Ewald/PME wrappers used torch.allclose(cell, self._cached_cell) to detect cell changes for cache invalidation. This assumes the current and cached cell tensors have identical shape, dtype, and device. When the same wrapper instance sees a different batch size, for example between training and validation batches, cell.shape changes from (B1, 3, 3) to (B2, 3, 3). In that case torch.allclose raises instead of returning False, so the cache cannot be safely invalidated and model training is affected.
Type of Change
Related Issues
Changes Made
Testing
make pytest)make lint)Checklist
Additional Notes
Tip
This repository uses Greptile, an AI code review service, to help conduct
pull request reviews. We encourage contributors to read and consider suggestions
made by Greptile, but note that human maintainers will provide the necessary
reviews for merging: Greptile's comments are not a qualitative judgement
of your code, nor is it an indication that the PR will be accepted/rejected.
We encourage the use of emoji reactions to Greptile comments, depending on
their usefulness and accuracy.