From c0f09e65a39d12b8a7c660f57c563ba6196df674 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 15 Dec 2024 09:15:51 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- deepmd/dpmodel/output_def.py | 2 +- deepmd/pt/loss/property.py | 4 +++- deepmd/pt/model/model/__init__.py | 2 +- deepmd/pt/utils/stat.py | 10 ++++++---- deepmd/utils/argcheck.py | 2 +- 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/deepmd/dpmodel/output_def.py b/deepmd/dpmodel/output_def.py index e3f79f654f..074d516a30 100644 --- a/deepmd/dpmodel/output_def.py +++ b/deepmd/dpmodel/output_def.py @@ -4,8 +4,8 @@ IntEnum, ) from typing import ( - Union, Optional, + Union, ) diff --git a/deepmd/pt/loss/property.py b/deepmd/pt/loss/property.py index 46ffc7153d..171f71f8e7 100644 --- a/deepmd/pt/loss/property.py +++ b/deepmd/pt/loss/property.py @@ -57,7 +57,9 @@ def __init__( property_dim = [property_dim] self.property_name = property_name assert self.task_dim == sum(property_dim) - assert len(property_name) == len(property_dim), f"The shape of the `property_name` you provide must be consistent with the `property_dim`, but your `property_name` is {property_name} and your `property_dim` is {property_dim}!" + assert ( + len(property_name) == len(property_dim) + ), f"The shape of the `property_name` you provide must be consistent with the `property_dim`, but your `property_name` is {property_name} and your `property_dim` is {property_dim}!" self.property_name_dim_mapping = dict(zip(property_name, property_dim)) self.out_bias = out_bias self.out_std = out_std diff --git a/deepmd/pt/model/model/__init__.py b/deepmd/pt/model/model/__init__.py index 770c4406d0..4f357ca1ea 100644 --- a/deepmd/pt/model/model/__init__.py +++ b/deepmd/pt/model/model/__init__.py @@ -100,7 +100,7 @@ def _get_standard_model_components(model_params, ntypes): fitting_net["return_energy"] = True if "property" in fitting_net["type"]: if isinstance(fitting_net["property_dim"], list): - fitting_net["task_dim"] = sum(fitting_net["property_dim"]) + fitting_net["task_dim"] = sum(fitting_net["property_dim"]) else: fitting_net["task_dim"] = fitting_net["property_dim"] fitting = BaseFitting(**fitting_net) diff --git a/deepmd/pt/utils/stat.py b/deepmd/pt/utils/stat.py index 115493cbfb..51297a721d 100644 --- a/deepmd/pt/utils/stat.py +++ b/deepmd/pt/utils/stat.py @@ -519,10 +519,12 @@ def compute_output_stats_global( concat_bias.append(bias_atom_e[ii]) concat_std.append(std_atom_e[ii]) bias_atom_e = {"property": np.concatenate(concat_bias, axis=-1)} - std_atom_e = {"property": np.tile( - np.concatenate(concat_std, axis=-1), - (bias_atom_e["property"].shape[0], 1) - )} + std_atom_e = { + "property": np.tile( + np.concatenate(concat_std, axis=-1), + (bias_atom_e["property"].shape[0], 1), + ) + } return bias_atom_e, std_atom_e diff --git a/deepmd/utils/argcheck.py b/deepmd/utils/argcheck.py index ff54595d99..d07d8d1054 100644 --- a/deepmd/utils/argcheck.py +++ b/deepmd/utils/argcheck.py @@ -2512,7 +2512,7 @@ def loss_property(): optional=True, default=1.00, doc=doc_beta, - ) + ), ]