class_docstr: Callback for auto-logging metrics and parameters.
class_docstr_tok: ["Callback","for","auto-logging","metrics","and","parameters","."]
code: def _log_metrics(self, trainer, step, metric_items):
      # pytorch-lightning runs a few steps of validation in the beginning of training
      # as a sanity check to catch bugs without having to wait for the training routine
      # to complete. During this check, we should skip logging metrics.
      # https://pytorch-lightning.readthedocs.io/en/stable/common/trainer.html#num-sanity-val-steps
      sanity_checking = (
          # `running_sanity_check` has been renamed to `sanity_checking`:
          # https://github.com/PyTorchLightning/pytorch-lightning/pull/9209
          trainer.sanity_checking
          if Version(pl.__version__) > Version("1.4.5")
          else trainer.running_sanity_check
      )
      if sanity_checking:
          return
  
      # Cast metric value as  float before passing into logger.
      metrics = {x[0]: float(x[1]) for x in metric_items}
      self.metrics_logger.record_metrics(metrics, step)
  
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 2 for calling the __MLflowPLCallback obj's underlying member method code with example usage: obj._log_metrics(trainer, step, metric_items) without return types