code: def get_num_training_steps(
      config: ml_collections.ConfigDict,
      dataset_metadata: Dict[str, Any],
  ) -> Tuple[int, Optional[int]]:
      """Calculates the total number of training step and possibly steps_per_epoch.
  
      The main raining loop is based on number of training steps. Thus, for datasets
      that we want to train based on number of epochs, we need to calculate the
      total number of training steps. This function looks for `num_training_steps`
      in config, if it exists it returns that as the total step and `None` as
      `steps_per_epoch`. If num_training_steps doesn't exist, then it looks for
      `num_training_epochs` and given the size of training data calculates the total
      steps and steps_per_epoch. In this computation, we assume that
      drop_remainder=True.
  
      Args:
        config: Configuration of the experiment.
        dataset_metadata: Meta-data that is generated by the dataset_builder.
  
      Returns:
        total_steps: Total number of training steps.
        steps_per_epoch: Number of steps in every epoch.
      """
      # We either use num_training_epochs or num_training_steps.
      steps_per_epoch = (
          dataset_metadata.get("num_train_examples", 0)
          // config.batch_size
      )
  
      if config.get("num_training_steps") is not None:
          assert not config.get("num_training_epochs")
          return config.num_training_steps, steps_per_epoch or None
      else:
          assert config.num_training_epochs and not config.get(
              "num_training_steps"
          )
          assert (
              steps_per_epoch > 0
          ), "num_train_examples should be defined."
          return (
              int(steps_per_epoch * config.num_training_epochs),
              steps_per_epoch,
          )
  
imports: import collections.abc
  import copy
  import functools
  import os
  import re
  import time
  from typing import Any, Callable, Dict, Mapping, Optional, Sequence, Tuple, Union
  from absl import logging
  from clu import metric_writers
  import flax
  from flax import jax_utils
  from flax import struct
  import flax.linen
  from flax.training import checkpoints
  import jax
  import jax.numpy
  import ml_collections
  import numpy
  import optax
  from scenic.common_lib import debug_utils
  from scenic.dataset_lib import dataset_utils
  from scenic.dataset_lib import datasets
  from scenic.train_lib import optimizers
  from tensorflow.io import gfile
label_desc: Use image node_id 5 for calling a global function with example usage: get_num_training_steps(config, dataset_metadata) and returns: config,  unknown, int,  steps_per_epoch