Skip to content

Commit

Permalink
refactor: making validation and test log to progress bar as well
Browse files Browse the repository at this point in the history
  • Loading branch information
laserkelvin committed Jul 19, 2024
1 parent 17c69c2 commit f19fa79
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions matsciml/models/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1083,7 +1083,7 @@ def validation_step(
"Unable to parse batch size from data, defaulting to `None` for logging.",
)
batch_size = None
self.log_dict(metrics, batch_size=batch_size)
self.log_dict(metrics, batch_size=batch_size, on_step=True, prog_bar=True)
if self.hparams.log_embeddings and "embeddings" in batch:
self._log_embedding(batch["embeddings"])
return loss_dict
Expand All @@ -1105,7 +1105,7 @@ def test_step(
"Unable to parse batch size from data, defaulting to `None` for logging.",
)
batch_size = None
self.log_dict(metrics, batch_size=batch_size)
self.log_dict(metrics, batch_size=batch_size, on_epoch=True, prog_bar=True)
if self.hparams.log_embeddings and "embeddings" in batch:
self._log_embedding(batch["embeddings"])
return loss_dict
Expand Down Expand Up @@ -1510,7 +1510,7 @@ def validation_step(
"Unable to parse batch size from data, defaulting to `None` for logging."
)
batch_size = None
self.log_dict(metrics, batch_size=batch_size)
self.log_dict(metrics, batch_size=batch_size, on_step=True, prog_bar=True)
return loss_dict

def test_step(
Expand All @@ -1531,7 +1531,7 @@ def test_step(
"Unable to parse batch size from data, defaulting to `None` for logging."
)
batch_size = None
self.log_dict(metrics, batch_size=batch_size)
self.log_dict(metrics, batch_size=batch_size, on_step=True, prog_bar=True)
return loss_dict

def on_train_batch_start(self, batch: Any, batch_idx: int) -> Optional[int]:
Expand Down

0 comments on commit f19fa79

Please sign in to comment.