code: def create_common_callbacks(
      epochs: int,
      tensorboard_log_dir: Optional[Text] = None,
      tensorboard_log_level: Optional[Text] = None,
      checkpoint_dir: Optional[Path] = None,
  ) -> List["Callback"]:
      """Create common callbacks.
  
      The following callbacks are created:
      - RasaTrainingLogger callback
      - Optional TensorBoard callback
      - Optional RasaModelCheckpoint callback
  
      Args:
          epochs: the number of epochs to train
          tensorboard_log_dir: optional directory that should be used for tensorboard
          tensorboard_log_level: defines when training metrics for tensorboard should be
                                 logged. Valid values: 'epoch' and 'batch'.
          checkpoint_dir: optional directory that should be used for model checkpointing
  
      Returns:
          A list of callbacks.
      """
      import tensorflow as tf
  
      callbacks = [RasaTrainingLogger(epochs, silent=False)]
  
      if tensorboard_log_dir:
          callbacks.append(
              tf.keras.callbacks.TensorBoard(
                  log_dir=tensorboard_log_dir,
                  update_freq=tensorboard_log_level,
                  write_graph=True,
                  write_images=True,
                  histogram_freq=10,
              )
          )
  
      if checkpoint_dir:
          callbacks.append(RasaModelCheckpoint(checkpoint_dir))
  
      return callbacks
  
imports: from pathlib import Path
  import numpy
  from typing import Optional, Text, Dict, Any, Union, List, Tuple, TYPE_CHECKING
  import rasa.shared.utils.common
  import rasa.shared.utils.io
  import rasa.nlu.utils.bilou_utils
  from rasa.shared.constants import NEXT_MAJOR_VERSION_FOR_DEPRECATIONS
  from rasa.nlu.constants import NUMBER_OF_SUB_TOKENS
  import rasa.utils.io
  from rasa.utils.tensorflow.constants import LOSS_TYPE, RANKING_LENGTH, RENORMALIZE_CONFIDENCES, SIMILARITY_TYPE, EVAL_NUM_EXAMPLES, EVAL_NUM_EPOCHS, EPOCHS, SOFTMAX, MARGIN, AUTO, INNER, COSINE, SEQUENCE, CROSS_ENTROPY, CONSTRAIN_SIMILARITIES, MODEL_CONFIDENCE, TOLERANCE, CHECKPOINT_MODEL
  from rasa.utils.tensorflow.callback import RasaTrainingLogger, RasaModelCheckpoint
  from rasa.utils.tensorflow.data_generator import RasaBatchDataGenerator
  from rasa.utils.tensorflow.model_data import RasaModelData
  from rasa.shared.nlu.constants import SPLIT_ENTITIES_BY_COMMA
  from rasa.shared.exceptions import InvalidConfigException
label_desc: Use image node_id 11 for calling a global function with example usage: create_common_callbacks(epochs, tensorboard_log_dir, tensorboard_log_level, checkpoint_dir) and returns: callbacks