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 Jan 9, 2025
1 parent cfbc88a commit 73a20b0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion deepmd/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ def main_parser() -> argparse.ArgumentParser:
)
parser_change_bias.add_argument(
"--skip-elementcheck",
action="store_false",
action="store_false",
help="Enable this option to skip element checks if any error occurs while retrieving statistical data.",
)

Expand Down
4 changes: 2 additions & 2 deletions deepmd/pt/entrypoints/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ def change_bias(
numb_batch: int = 0,
model_branch: Optional[str] = None,
output: Optional[str] = None,
elem_check_stat: bool = True,
elem_check_stat: bool = True,
) -> None:
if input_file.endswith(".pt"):
old_state_dict = torch.load(
Expand Down Expand Up @@ -473,7 +473,7 @@ def change_bias(
data_single.systems,
data_single.dataloaders,
nbatches,
enable_element_completion = elem_check_stat,
enable_element_completion=elem_check_stat,
)
updated_model = training.model_change_out_bias(
model_to_change, sampled_data, _bias_adjust_mode=bias_adjust_mode
Expand Down
12 changes: 5 additions & 7 deletions deepmd/pt/utils/stat.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,11 @@ def process_with_new_frame(sys_indices, newele_counter, miss):
newele_counter += 1
if newele_counter <= min_frames_per_element_forstat:
frame_data = sys.__getitem__(frame)
assert (
miss in frame_data["atype"]
), (
f"Element check failed. "
f"If you are running in 'change-bias' mode, use '--skip-elementcheck' to disable this check. "
f"If you encountered this error during model training, set 'enable_element_completion' to False "
f"in the 'training' section of your input file."
assert miss in frame_data["atype"], (
"Element check failed. "
"If you are running in 'change-bias' mode, use '--skip-elementcheck' to disable this check. "
"If you encountered this error during model training, set 'enable_element_completion' to False "
"in the 'training' section of your input file."
)
sys_stat_new = {}
for dd in frame_data:
Expand Down

0 comments on commit 73a20b0

Please sign in to comment.