Skip to content

Commit

Permalink
fix: lcurve header wrong when no validation data (#3774)
Browse files Browse the repository at this point in the history
  • Loading branch information
iProzd authored May 12, 2024
1 parent 18cdbf0 commit 1708164
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions deepmd/pt/train/training.py
Original file line number Diff line number Diff line change
Expand Up @@ -909,7 +909,7 @@ def log_loss_valid(_task_key="Default"):
learning_rate=cur_lr,
)
)
if valid_results is not None and valid_results[_key]:
if valid_results[_key]:
log.info(
format_training_message_per_task(
batch=_step_id,
Expand Down Expand Up @@ -1118,7 +1118,7 @@ def print_header(self, fout, train_results, valid_results):
print_str = ""
print_str += "# %5s" % "step"
if not self.multi_task:
if valid_results is not None:
if valid_results:
prop_fmt = " %11s %11s"
for k in train_keys:
print_str += prop_fmt % (k + "_val", k + "_trn")
Expand All @@ -1128,7 +1128,7 @@ def print_header(self, fout, train_results, valid_results):
print_str += prop_fmt % (k + "_trn")
else:
for model_key in self.model_keys:
if valid_results[model_key] is not None:
if valid_results[model_key]:
prop_fmt = " %11s %11s"
for k in sorted(train_results[model_key].keys()):
print_str += prop_fmt % (
Expand Down

0 comments on commit 1708164

Please sign in to comment.