class_docstr: Logger that sends system metrics to W&B.
  
  `WandbMetricsLogger` automatically logs the `logs` dictionary that callback methods
  take as argument to wandb.
  
  This callback automatically logs the following to a W&B run page:
  * system (CPU/GPU/TPU) metrics,
  * train and validation metrics defined in `model.compile`,
  * learning rate (both for a fixed value or a learning rate scheduler)
  
  Notes:
  If you resume training by passing `initial_epoch` to `model.fit` and you are using a
  learning rate scheduler, make sure to pass `initial_global_step` to
  `WandbMetricsLogger`. The `initial_global_step` is `step_size * initial_step`, where
  `step_size` is number of training steps per epoch. `step_size` can be calculated as
  the product of the cardinality of the training dataset and the batch size.
  
  Arguments:
      log_freq: ("epoch", "batch", or int) if "epoch", logs metrics
          at the end of each epoch. If "batch", logs metrics at the end
          of each batch. If an integer, logs metrics at the end of that
          many batches. Defaults to "epoch".
      initial_global_step: (int) Use this argument to correcly log the
          learning rate when you resume training from some `initial_epoch`,
          and a learning rate scheduler is used. This can be computed as
          `step_size * initial_step`. Defaults to 0.
code: def _get_lr(self) -> Union[float, None]:
      if isinstance(self.model.optimizer.learning_rate, tf.Variable):
          return float(
              self.model.optimizer.learning_rate.numpy().item()
          )
      try:
          return float(
              self.model.optimizer.learning_rate(step=self.global_step)
              .numpy()
              .item()
          )
      except Exception:
          wandb.termerror("Unable to log learning rate.", repeat=False)
          return None
  
file_path: wandb/wandb/integration/keras/callbacks/metrics_logger.py
imports: import sys
  from typing import Any, Dict, Optional, Union
  import tensorflow
  from tensorflow.keras import callbacks
  import wandb
  from wandb.integration.keras.keras import patch_tf_keras
  from wandb.sdk.lib import telemetry
label_desc: Use image node_id 2 for calling the WandbMetricsLogger obj's underlying member method code with example usage: obj._get_lr() and returns: float, float, None