Skip to content

Commit

Permalink
Merge branch 'devel' into model-method
Browse files Browse the repository at this point in the history
Signed-off-by: Jinzhe Zeng <[email protected]>
  • Loading branch information
njzjz authored Feb 12, 2024
2 parents e8ceb78 + c131c8f commit 5694ded
Show file tree
Hide file tree
Showing 71 changed files with 4,396 additions and 3,303 deletions.
25 changes: 25 additions & 0 deletions deepmd/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,31 @@
__version__,
)


def DeepPotential(*args, **kwargs):
"""Factory function that forwards to DeepEval (for compatbility
and performance).
Parameters
----------
*args
positional arguments
**kwargs
keyword arguments
Returns
-------
DeepEval
potentials
"""
from deepmd.infer import (
DeepPotential,
)

return DeepPotential(*args, **kwargs)


__all__ = [
"__version__",
"DeepPotential",
]
8 changes: 3 additions & 5 deletions deepmd/dpmodel/descriptor/make_base_descriptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,13 @@ def distinguish_types(self) -> bool:
"""
pass

@abstractmethod
def compute_input_stats(self, merged):
"""Update mean and stddev for descriptor elements."""
pass
raise NotImplementedError

@abstractmethod
def init_desc_stat(self, sumr, suma, sumn, sumr2, suma2):
def init_desc_stat(self, **kwargs):
"""Initialize the model bias by the statistics."""
pass
raise NotImplementedError

@abstractmethod
def fwd(
Expand Down
8 changes: 8 additions & 0 deletions deepmd/dpmodel/fitting/invar_fitting.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,14 @@ def __getitem__(self, key):
else:
raise KeyError(key)

def compute_output_stats(self, merged):
"""Update the output bias for fitting net."""
raise NotImplementedError

def init_fitting_stat(self, result_dict):
"""Initialize the model bias by the statistics."""
raise NotImplementedError

def serialize(self) -> dict:
"""Serialize the fitting to dict."""
return {
Expand Down
8 changes: 8 additions & 0 deletions deepmd/dpmodel/fitting/make_base_fitting.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ def fwd(
"""Calculate fitting."""
pass

def compute_output_stats(self, merged):
"""Update the output bias for fitting net."""
raise NotImplementedError

def init_fitting_stat(self, **kwargs):
"""Initialize the model bias by the statistics."""
raise NotImplementedError

@abstractmethod
def serialize(self) -> dict:
"""Serialize the obj to dict."""
Expand Down
Loading

0 comments on commit 5694ded

Please sign in to comment.