Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Dec 18, 2024
1 parent 15eb6d0 commit dbf394c
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 14 deletions.
4 changes: 0 additions & 4 deletions deepmd/dpmodel/output_def.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
from enum import (
IntEnum,
)
from typing import (
Optional,
Union,
)


def check_shape(
Expand Down
8 changes: 7 additions & 1 deletion deepmd/entrypoints/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,13 @@ def test_property(
assert isinstance(property_name, str)
data.add(property_name, dp.task_dim, atomic=False, must=True, high_prec=True)
if has_atom_property:
data.add(f"atom_{property_name}", dp.task_dim, atomic=True, must=False, high_prec=True)
data.add(
f"atom_{property_name}",
dp.task_dim,
atomic=True,
must=False,
high_prec=True,
)

if dp.get_dim_fparam() > 0:
data.add(
Expand Down
17 changes: 12 additions & 5 deletions deepmd/pt/model/model/property_model.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# SPDX-License-Identifier: LGPL-3.0-or-later
from typing import (
Optional,
Union,
)

import torch
Expand Down Expand Up @@ -63,8 +62,12 @@ def forward(
do_atomic_virial=do_atomic_virial,
)
model_predict = {}
model_predict[f"atom_{self.get_property_name()}"] = model_ret[self.get_property_name()]
model_predict[self.get_property_name()] = model_ret[f"{self.get_property_name()}_redu"]
model_predict[f"atom_{self.get_property_name()}"] = model_ret[
self.get_property_name()
]
model_predict[self.get_property_name()] = model_ret[
f"{self.get_property_name()}_redu"
]
if "mask" in model_ret:
model_predict["mask"] = model_ret["mask"]
return model_predict
Expand Down Expand Up @@ -108,8 +111,12 @@ def forward_lower(
extra_nlist_sort=self.need_sorted_nlist_for_lower(),
)
model_predict = {}
model_predict[f"atom_{self.get_property_name()}"] = model_ret[self.get_property_name()]
model_predict[self.get_property_name()] = model_ret[f"{self.get_property_name()}_redu"]
model_predict[f"atom_{self.get_property_name()}"] = model_ret[
self.get_property_name()
]
model_predict[self.get_property_name()] = model_ret[
f"{self.get_property_name()}_redu"
]
if "mask" in model_ret:
model_predict["mask"] = model_ret["mask"]
return model_predict
3 changes: 0 additions & 3 deletions deepmd/pt/utils/stat.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
import numpy as np
import torch

from deepmd.dpmodel.output_def import (
FittingOutputDef,
)
from deepmd.pt.utils import (
AtomExcludeMask,
)
Expand Down
2 changes: 1 addition & 1 deletion deepmd/utils/out_stat.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,4 +181,4 @@ def compute_stats_property(
output_std = output_std.reshape(var_shape)
output_std = np.tile(output_std, (computed_output_bias.shape[0], 1))

return computed_output_bias, output_std
return computed_output_bias, output_std

0 comments on commit dbf394c

Please sign in to comment.