You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(pt_expt): implement .pte inference pipeline with dynamic shapes (#5284)
Implement the full pt_expt inference pipeline: serialize models to .pte
files via torch.export, and load them for inference via
DeepPot/DeepEval.
Key changes:
- Add DeepEval backend for .pte files
(deepmd/pt_expt/infer/deep_eval.py)
- Add serialize/deserialize hooks
(deepmd/pt_expt/utils/serialization.py)
- Wire up backend hooks in deepmd/backend/pt_expt.py
- Add forward_common_lower_exportable using make_fx + torch.export
- Support dynamic nframes, nloc, and nall dimensions
- Fix atomic_virial_corr to use explicit loop instead of vmap
Add xp_take_first_n helper to avoid torch.export contiguity guards on
[:, :nloc] slices. When torch.export traces tensor[:, :nloc] on a tensor
of size nall, it records a Ne(nall, nloc) guard from the view's
contiguity check, which fails when nall == nloc (no PBC). Using
torch.index_select instead creates a new tensor, avoiding the guard.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **New Features**
* PyTorch-exportable inference for exported models with flexible
batching and neighbor-list support.
* Model serialize/deserialize flow that preserves dynamic shapes and
includes round-trip import/export.
* New neighbor-statistics utility for PyTorch.
* Array utility to take the first N elements with a Torch-optimized
path.
* **Improvements**
* Enhanced export/tracing reliability and array handling to preserve
dynamic shapes.
* Backend hooks implemented for PyTorch evaluation paths.
* **Tests**
* Extensive tests for inference consistency, serialization round-trips,
and multi-frame scenarios.
* **Chores**
* Added SPDX license headers.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: Han Wang <wang_han@iapcm.ac.cn>
0 commit comments