-
Notifications
You must be signed in to change notification settings - Fork 520
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor DeepEval #3213
refactor DeepEval #3213
Conversation
Signed-off-by: Jinzhe Zeng <[email protected]>
Signed-off-by: Jinzhe Zeng <[email protected]>
deepmd/tf/infer/deep_eval.py
Outdated
# for idx,ii in enumerate(imap) : | ||
# ret[:,ii,:] = vec[:,idx,:] |
Check notice
Code scanning / CodeQL
Commented-out code Note
def eval_full( | ||
self, | ||
coords: np.ndarray, | ||
cells: Optional[np.ndarray], | ||
atom_types: np.ndarray, | ||
atomic: bool = False, | ||
fparam: Optional[np.ndarray] = None, | ||
aparam: Optional[np.ndarray] = None, | ||
mixed_type: bool = False, | ||
**kwargs: dict, | ||
) -> Tuple[np.ndarray, ...]: |
Check notice
Code scanning / CodeQL
Returning tuples with varying lengths Note
tuple of size 3
tuple of size 5
if cls is DeepEvalBase: | ||
backend = detect_backend(model_file) | ||
if backend == DPBackend.TensorFlow: | ||
from deepmd.tf.infer.deep_eval import DeepEval as DeepEvalTF |
Check notice
Code scanning / CodeQL
Cyclic import Note
deepmd.tf.infer.deep_eval
|
||
return super().__new__(DeepEvalTF) | ||
elif backend == DPBackend.PyTorch: | ||
from deepmd.pt.infer.deep_eval import DeepEval as DeepEvalPT |
Check notice
Code scanning / CodeQL
Cyclic import Note
deepmd.pt.infer.deep_eval
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## devel #3213 +/- ##
==========================================
- Coverage 75.32% 75.19% -0.13%
==========================================
Files 366 372 +6
Lines 32966 33136 +170
Branches 1608 1608
==========================================
+ Hits 24830 24916 +86
- Misses 7263 7347 +84
Partials 873 873 ☔ View full report in Codecov by Sentry. |
Signed-off-by: Jinzhe Zeng <[email protected]>
Signed-off-by: Jinzhe Zeng <[email protected]>
Signed-off-by: Jinzhe Zeng <[email protected]>
Signed-off-by: Jinzhe Zeng <[email protected]>
from deepmd.infer.deep_tensor import ( | ||
DeepTensor, | ||
) |
Check notice
Code scanning / CodeQL
Cyclic import Note
deepmd.infer.deep_tensor
from .deep_eval import ( | ||
DeepEval, | ||
) |
Check notice
Code scanning / CodeQL
Cyclic import Note
deepmd.infer.deep_eval
from deepmd.infer.deep_tensor import ( | ||
DeepTensor, | ||
) |
Check notice
Code scanning / CodeQL
Cyclic import Note
deepmd.infer.deep_tensor
from deepmd.infer.deep_tensor import ( | ||
DeepTensor, | ||
) |
Check notice
Code scanning / CodeQL
Cyclic import Note
deepmd.infer.deep_tensor
Signed-off-by: Jinzhe Zeng <[email protected]>
from deepmd.infer.deep_pot import ( | ||
DeepPot, | ||
) |
Check notice
Code scanning / CodeQL
Cyclic import Note
deepmd.infer.deep_pot
from deepmd.infer.deep_pot import ( | ||
DeepPot, | ||
) |
Check notice
Code scanning / CodeQL
Cyclic import Note
deepmd.infer.deep_pot
from deepmd.infer.deep_wfc import ( | ||
DeepWFC, | ||
) |
Check notice
Code scanning / CodeQL
Cyclic import Note
deepmd.infer.deep_wfc
from deepmd.infer.deep_eval import ( | ||
DeepEval, | ||
) |
Check notice
Code scanning / CodeQL
Cyclic import Note
deepmd.infer.deep_eval
Signed-off-by: Jinzhe Zeng <[email protected]>
Signed-off-by: Jinzhe Zeng <[email protected]>
from deepmd.infer.deep_eval import ( | ||
DeepEvalBackend, | ||
) |
Check notice
Code scanning / CodeQL
Cyclic import Note
deepmd.infer.deep_eval
from deepmd.infer.deep_dos import ( | ||
DeepDOS, | ||
) |
Check notice
Code scanning / CodeQL
Cyclic import Note
deepmd.infer.deep_dos
from deepmd.infer.deep_eval import ( | ||
DeepEvalBackend, | ||
) |
Check notice
Code scanning / CodeQL
Cyclic import Note
deepmd.infer.deep_eval
Co-authored-by: Han Wang <[email protected]> Signed-off-by: Jinzhe Zeng <[email protected]>
Signed-off-by: Jinzhe Zeng <[email protected]>
Signed-off-by: Jinzhe Zeng <[email protected]>
Signed-off-by: Jinzhe Zeng <[email protected]>
To be consistent with TF, as discussed in #3213 (comment). Old PT models are expected to be incompatible. Signed-off-by: Jinzhe Zeng <[email protected]>
Signed-off-by: Jinzhe Zeng <[email protected]>
Signed-off-by: Jinzhe Zeng <[email protected]>
Signed-off-by: Jinzhe Zeng <[email protected]>
Signed-off-by: Jinzhe Zeng <[email protected]>
Signed-off-by: Jinzhe Zeng <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Signed-off-by: Jinzhe Zeng <[email protected]>
def eval( | ||
self, | ||
coords: np.ndarray, | ||
cells: Optional[np.ndarray], | ||
atom_types: Union[List[int], np.ndarray], | ||
atomic: bool = False, | ||
fparam: Optional[np.ndarray] = None, | ||
aparam: Optional[np.ndarray] = None, | ||
mixed_type: bool = False, | ||
**kwargs: Dict[str, Any], | ||
) -> Tuple[np.ndarray, ...]: |
Check notice
Code scanning / CodeQL
Returning tuples with varying lengths Note
tuple of size 1
tuple of size 2
…entiable and c_differentiable Signed-off-by: Jinzhe Zeng <[email protected]>
Signed-off-by: Jinzhe Zeng <[email protected]>
A downgrade in deepmodeling#3213. Signed-off-by: Jinzhe Zeng <[email protected]>
A downgrade in #3213. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added support for `modifier_type` in the evaluation process to enhance model flexibility. - **Tests** - Introduced unit tests for deep potential model evaluation using TensorFlow. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Signed-off-by: Jinzhe Zeng <[email protected]>
A downgrade in deepmodeling#3213. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added support for `modifier_type` in the evaluation process to enhance model flexibility. - **Tests** - Introduced unit tests for deep potential model evaluation using TensorFlow. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Signed-off-by: Jinzhe Zeng <[email protected]>
Implement high-level
DeepEval
and low-levelDeepEvalBackend
.Ugly things:
(1)
DipoleChargeModifier
is not updated in this PR. Thus, it still inherits from the oldDeepEval
. (It should not inherit fromDeepEval
!!!)(2) There are no unit tests or testing models for DeepGlobarPolar or DeepWFC.
(3) The shape of the atomic tensor looks different from forces and atomic virials.
TODO: