class_docstr: Callback for auto-logging metrics and parameters.
class_docstr_tok: ["Callback","for","auto-logging","metrics","and","parameters","."]
docstr: Logs Optimizer related metrics when the train begins
  
  :param trainer: pytorch lightning trainer instance
  :param pl_module: pytorch lightning base module
docstr_tok: ["Logs","Optimizer","related","metrics","when","the","train","begins",":","param","trainer",":","pytorch","lightning","trainer","instance",":","param","pl_module",":","pytorch","lightning","base","module"]
code: def on_train_start(self, trainer, pl_module):
      """
      Logs Optimizer related metrics when the train begins
  
      :param trainer: pytorch lightning trainer instance
      :param pl_module: pytorch lightning base module
      """
      self.client.set_tags(self.run_id, {"Mode": "training"})
  
      params = {"epochs": trainer.max_epochs}
  
      # TODO For logging optimizer params - Following scenarios are to revisited.
      # 1. In the current scenario, only the first optimizer details are logged.
      #    Code to be enhanced to log params when multiple optimizers are used.
      # 2. mlflow.log_params is used to store optimizer default values into mlflow.
      #    The keys in default dictionary are too short, Ex: (lr - learning_rate).
      #    Efficient mapping technique needs to be introduced
      #    to rename the optimizer parameters based on keys in default dictionary.
  
      if hasattr(trainer, "optimizers"):
          # Lightning >= 1.6.0 increments the global step every time an optimizer is stepped.
          # We assume every optimizer will be stepped in each training step.
          if _pl_version >= Version("1.6.0"):
              self._global_steps_per_training_step = len(
                  trainer.optimizers
              )
          optimizer = trainer.optimizers[0]
          params["optimizer_name"] = _get_optimizer_name(optimizer)
  
          if hasattr(optimizer, "defaults"):
              params.update(optimizer.defaults)
  
      self.client.log_params(self.run_id, params)
      self.client.flush(synchronous=True)
  
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 5 for calling the __MLflowPLCallback obj's underlying member method code with example usage: obj.on_train_start(trainer, pl_module) without return types