Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pt: fix print_on_training when there is no validation data #3423

Merged
merged 1 commit into from
Mar 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions deepmd/pt/train/training.py
Original file line number Diff line number Diff line change
Expand Up @@ -1016,7 +1016,7 @@
print_str = ""
print_str += "%7d" % step_id
if not self.multi_task:
if valid_results is not None:
if valid_results:

Check warning on line 1019 in deepmd/pt/train/training.py

View check run for this annotation

Codecov / codecov/patch

deepmd/pt/train/training.py#L1019

Added line #L1019 was not covered by tests
prop_fmt = " %11.2e %11.2e"
for k in train_keys:
print_str += prop_fmt % (valid_results[k], train_results[k])
Expand All @@ -1026,7 +1026,7 @@
print_str += prop_fmt % (train_results[k])
else:
for model_key in self.model_keys:
if valid_results[model_key] is not None:
if valid_results[model_key]:

Check warning on line 1029 in deepmd/pt/train/training.py

View check run for this annotation

Codecov / codecov/patch

deepmd/pt/train/training.py#L1029

Added line #L1029 was not covered by tests
prop_fmt = " %11.2e %11.2e"
for k in sorted(valid_results[model_key].keys()):
print_str += prop_fmt % (
Expand Down