Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
awaelchli committed Jan 13, 2023
1 parent 00977f0 commit 67557c4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 5 additions & 2 deletions src/pytorch_lightning/callbacks/progress/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,9 +267,12 @@ def get_standard_metrics(trainer: "pl.Trainer", pl_module: "pl.LightningModule")
Return:
Dictionary with the standard metrics to be displayed in the progress bar.
"""
# call .item() only once but store elements without graphs
loss_metric = trainer.fit_loop._results.get("training_step.train_loss")
loss_value = None
loss_metric = None

# call .item() only once but store elements without graphs
if trainer.training:
loss_metric = trainer.fit_loop._results.get("training_step.train_loss")
if loss_metric is not None:
loss_value = loss_metric.value.cpu().item()
elif pl_module.automatic_optimization:
Expand Down
2 changes: 0 additions & 2 deletions src/pytorch_lightning/loops/epoch/training_epoch_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
import numpy as np
import torch
from lightning_utilities.core.apply_func import apply_to_collection
from torch import Tensor
from lightning_utilities.core.rank_zero import WarningCache

import pytorch_lightning as pl
from pytorch_lightning import loops # import as loops to avoid circular imports
Expand Down

0 comments on commit 67557c4

Please sign in to comment.