code: def run_fn(fn_args: tfx.components.FnArgs):
      """Train the model based on given args.
  
      Args:
        fn_args: Holds args used to train the model as name/value pairs.
      """
      tf_transform_output = tft.TFTransformOutput(
          fn_args.transform_output
      )
  
      train_dataset = base.input_fn(
          fn_args.train_files,
          fn_args.data_accessor,
          tf_transform_output,
          base.TRAIN_BATCH_SIZE,
      )
  
      eval_dataset = base.input_fn(
          fn_args.eval_files,
          fn_args.data_accessor,
          tf_transform_output,
          base.EVAL_BATCH_SIZE,
      )
  
      if fn_args.hyperparameters:
          hparams = keras_tuner.HyperParameters.from_config(
              fn_args.hyperparameters
          )
      else:
          # This is a shown case when hyperparameters is decided and Tuner is removed
          # from the pipeline. User can also inline the hyperparameters directly in
          # _build_keras_model.
          hparams = _get_hyperparameters()
      absl.logging.info(
          "HyperParameters for training: %s" % hparams.get_config()
      )
  
      mirrored_strategy = tf.distribute.MirroredStrategy()
      with mirrored_strategy.scope():
          model = _make_keras_model(hparams)
  
      # Write logs to path
      tensorboard_callback = tf.keras.callbacks.TensorBoard(
          log_dir=fn_args.model_run_dir, update_freq="epoch"
      )
  
      model.fit(
          train_dataset,
          steps_per_epoch=fn_args.train_steps,
          validation_data=eval_dataset,
          validation_steps=fn_args.eval_steps,
          callbacks=[tensorboard_callback],
      )
  
      signatures = base.make_serving_signatures(
          model, tf_transform_output
      )
      model.save(
          fn_args.serving_model_dir,
          save_format="tf",
          signatures=signatures,
      )
  
file_path: tfx/tfx/examples/penguin/penguin_utils_keras.py
imports: import absl
  import keras_tuner
  import tensorflow
  from tensorflow import keras
  import tensorflow_transform
  from tfx import v1
  from tfx.examples.penguin import penguin_utils_base
label_desc: Use image node_id 4 for calling a global function with example usage: run_fn(fn_args) without return types