Skip to content

Commit

Permalink
breaking change the default values
Browse files Browse the repository at this point in the history
  • Loading branch information
iProzd committed Sep 5, 2024
1 parent 315a174 commit ec44efe
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 25 deletions.
10 changes: 5 additions & 5 deletions deepmd/dpmodel/descriptor/dpa2.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,9 @@ def __init__(
update_residual_init: str = "norm",
set_davg_zero: bool = True,
trainable_ln: bool = True,
use_sqrt_nnei: bool = False,
g1_out_conv: bool = False,
g1_out_mlp: bool = False,
use_sqrt_nnei: bool = True,
g1_out_conv: bool = True,
g1_out_mlp: bool = True,
ln_eps: Optional[float] = 1e-5,
):
r"""The constructor for the RepformerArgs class which defines the parameters of the repformer block in DPA2 descriptor.
Expand Down Expand Up @@ -850,7 +850,7 @@ def serialize(self) -> dict:
data = {
"@class": "Descriptor",
"type": "dpa2",
"@version": 2,
"@version": 3,
"ntypes": self.ntypes,
"repinit_args": self.repinit_args.serialize(),
"repformer_args": self.repformer_args.serialize(),
Expand Down Expand Up @@ -927,7 +927,7 @@ def serialize(self) -> dict:
@classmethod
def deserialize(cls, data: dict) -> "DescrptDPA2":
data = data.copy()
check_version_compatibility(data.pop("@version"), 2, 1)
check_version_compatibility(data.pop("@version"), 3, 3)
data.pop("@class")
data.pop("type")
repinit_variable = data.pop("repinit_variable").copy()
Expand Down
16 changes: 8 additions & 8 deletions deepmd/dpmodel/descriptor/repformers.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,9 @@ def __init__(
env_protection: float = 0.0,
precision: str = "float64",
trainable_ln: bool = True,
use_sqrt_nnei: bool = False,
g1_out_conv: bool = False,
g1_out_mlp: bool = False,
use_sqrt_nnei: bool = True,
g1_out_conv: bool = True,
g1_out_mlp: bool = True,
ln_eps: Optional[float] = 1e-5,
seed: Optional[Union[int, List[int]]] = None,
):
Expand Down Expand Up @@ -544,7 +544,7 @@ def _cal_hg(
sw: np.ndarray,
smooth: bool = True,
epsilon: float = 1e-4,
use_sqrt_nnei: bool = False,
use_sqrt_nnei: bool = True,
) -> np.ndarray:
"""
Calculate the transposed rotation matrix.
Expand Down Expand Up @@ -635,7 +635,7 @@ def symmetrization_op(
axis_neuron: int,
smooth: bool = True,
epsilon: float = 1e-4,
use_sqrt_nnei: bool = False,
use_sqrt_nnei: bool = True,
) -> np.ndarray:
"""
Symmetrization operator to obtain atomic invariant rep.
Expand Down Expand Up @@ -1128,9 +1128,9 @@ def __init__(
smooth: bool = True,
precision: str = "float64",
trainable_ln: bool = True,
use_sqrt_nnei: bool = False,
g1_out_conv: bool = False,
g1_out_mlp: bool = False,
use_sqrt_nnei: bool = True,
g1_out_conv: bool = True,
g1_out_mlp: bool = True,
ln_eps: Optional[float] = 1e-5,
seed: Optional[Union[int, List[int]]] = None,
):
Expand Down
4 changes: 2 additions & 2 deletions deepmd/pt/model/descriptor/dpa2.py
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ def serialize(self) -> dict:
data = {
"@class": "Descriptor",
"type": "dpa2",
"@version": 2,
"@version": 3,
"ntypes": self.ntypes,
"repinit_args": self.repinit_args.serialize(),
"repformer_args": self.repformer_args.serialize(),
Expand Down Expand Up @@ -603,7 +603,7 @@ def serialize(self) -> dict:
@classmethod
def deserialize(cls, data: dict) -> "DescrptDPA2":
data = data.copy()
check_version_compatibility(data.pop("@version"), 2, 1)
check_version_compatibility(data.pop("@version"), 3, 3)
data.pop("@class")
data.pop("type")
repinit_variable = data.pop("repinit_variable").copy()
Expand Down
8 changes: 4 additions & 4 deletions deepmd/pt/model/descriptor/repformer_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -599,9 +599,9 @@ def __init__(
precision: str = "float64",
trainable_ln: bool = True,
ln_eps: Optional[float] = 1e-5,
use_sqrt_nnei: bool = False,
g1_out_conv: bool = False,
g1_out_mlp: bool = False,
use_sqrt_nnei: bool = True,
g1_out_conv: bool = True,
g1_out_mlp: bool = True,
seed: Optional[Union[int, List[int]]] = None,
):
super().__init__()
Expand Down Expand Up @@ -925,7 +925,7 @@ def _cal_hg(
sw: torch.Tensor,
smooth: bool = True,
epsilon: float = 1e-4,
use_sqrt_nnei: bool = False,
use_sqrt_nnei: bool = True,
) -> torch.Tensor:
"""
Calculate the transposed rotation matrix.
Expand Down
6 changes: 3 additions & 3 deletions deepmd/pt/model/descriptor/repformers.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ def __init__(
trainable_ln: bool = True,
ln_eps: Optional[float] = 1e-5,
seed: Optional[Union[int, List[int]]] = None,
use_sqrt_nnei: bool = False,
g1_out_conv: bool = False,
g1_out_mlp: bool = False,
use_sqrt_nnei: bool = True,
g1_out_conv: bool = True,
g1_out_mlp: bool = True,
old_impl: bool = False,
):
r"""
Expand Down
6 changes: 3 additions & 3 deletions deepmd/utils/argcheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -1216,21 +1216,21 @@ def dpa2_repformer_args():
"use_sqrt_nnei",
bool,
optional=True,
default=False,
default=True,
doc=doc_use_sqrt_nnei,
),
Argument(
"g1_out_conv",
bool,
optional=True,
default=False,
default=True,
doc=doc_g1_out_conv,
),
Argument(
"g1_out_mlp",
bool,
optional=True,
default=False,
default=True,
doc=doc_g1_out_mlp,
),
Argument(
Expand Down

0 comments on commit ec44efe

Please sign in to comment.