Skip to content

Commit d38c398

Browse files
authored
fix(pt): use eval mode in the Python interface (#4404)
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 <jinzhe.zeng@rutgers.edu>
1 parent cb7a0d3 commit d38c398

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

deepmd/pt/infer/deep_eval.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ def __init__(
143143
self.model_def_script = {}
144144
else:
145145
raise ValueError("Unknown model file format!")
146+
self.dp.eval()
146147
self.rcut = self.dp.model["Default"].get_rcut()
147148
self.type_map = self.dp.model["Default"].get_type_map()
148149
if isinstance(auto_batch_size, bool):

0 commit comments

Comments
 (0)