Skip to content

Commit

Permalink
fix(pt): use eval mode in the Python interface (#4404)
Browse files Browse the repository at this point in the history
Same as #4402

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Enhanced model initialization by ensuring the model is set to
evaluation mode immediately after loading, improving inference accuracy.
  
- **Bug Fixes**
- Corrected the control flow during model setup to prevent potential
issues during evaluation.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Signed-off-by: Jinzhe Zeng <[email protected]>
  • Loading branch information
njzjz authored Nov 23, 2024
1 parent cb7a0d3 commit d38c398
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions deepmd/pt/infer/deep_eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ def __init__(
self.model_def_script = {}
else:
raise ValueError("Unknown model file format!")
self.dp.eval()
self.rcut = self.dp.model["Default"].get_rcut()
self.type_map = self.dp.model["Default"].get_type_map()
if isinstance(auto_batch_size, bool):
Expand Down

0 comments on commit d38c398

Please sign in to comment.