class_docstr: Callback for auto-logging metrics and parameters.
class_docstr_tok: ["Callback","for","auto-logging","metrics","and","parameters","."]
code: def _log_epoch_metrics(self, trainer, pl_module):
      # `trainer.callback_metrics` contains both training and validation metrics
      # and includes metrics logged on steps and epochs.
      # If we have logged any metrics on a step basis in mlflow, we exclude these from the
      # epoch level metrics to prevent mixing epoch and step based values.
      metric_items = [
          (name, val)
          for (name, val) in trainer.callback_metrics.items()
          if name not in self._step_metrics
      ]
      # Record which metrics are logged on epochs, so we don't try to log these on steps
      self._epoch_metrics.update(name for (name, _) in metric_items)
      if (pl_module.current_epoch + 1) % self.log_every_n_epoch == 0:
          self._log_metrics(
              trainer, pl_module.current_epoch, metric_items
          )
  
imports: import logging
  import os
  import tempfile
  import warnings
  from packaging.version import Version
  import mlflow.pytorch
  from mlflow.exceptions import MlflowException
  from mlflow.ml_package_versions import _ML_PACKAGE_VERSIONS
  from mlflow.pytorch import _pytorch_autolog
  from mlflow.utils.autologging_utils import BatchMetricsLogger, ExceptionSafeAbstractClass, MlflowAutologgingQueueingClient, get_autologging_config
  import pytorch_lightning
  from pytorch_lightning.utilities import rank_zero_only
label_desc: Use image node_id 3 for calling the __MLflowPLCallback obj's underlying member method code with example usage: obj._log_epoch_metrics(trainer, pl_module) without return types