Skip to content

Commit

Permalink
pt: fix print_on_training when there is no validation data (#3423)
Browse files Browse the repository at this point in the history
#3405 changed results from `None` to `{}` but `print_on_training` wasn't
revised.
  • Loading branch information
njzjz authored Mar 8, 2024
1 parent 268591c commit fefc0e6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions deepmd/pt/train/training.py
Original file line number Diff line number Diff line change
Expand Up @@ -1037,7 +1037,7 @@ def print_on_training(self, fout, step_id, cur_lr, train_results, valid_results)
print_str = ""
print_str += "%7d" % step_id
if not self.multi_task:
if valid_results is not None:
if valid_results:
prop_fmt = " %11.2e %11.2e"
for k in train_keys:
print_str += prop_fmt % (valid_results[k], train_results[k])
Expand All @@ -1047,7 +1047,7 @@ def print_on_training(self, fout, step_id, cur_lr, train_results, valid_results)
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]:
prop_fmt = " %11.2e %11.2e"
for k in sorted(valid_results[model_key].keys()):
print_str += prop_fmt % (
Expand Down

0 comments on commit fefc0e6

Please sign in to comment.