code: def run_fn(fn_args: executor.TrainerFnArgs):
      """Train the model based on given args.
  
      Args:
        fn_args: Holds args used to train the model as name/value pairs.
      """
      schema = io_utils.parse_pbtxt_file(
          fn_args.schema_file, schema_pb2.Schema()
      )
  
      training_spec = trainer_fn(fn_args, schema)
  
      # Train the model
      absl.logging.info("Training model.")
      tf_estimator.train_and_evaluate(
          training_spec["estimator"],
          training_spec["train_spec"],
          training_spec["eval_spec"],
      )
  
      # Export an eval savedmodel for TFMA
      # NOTE: When trained in distributed training cluster, eval_savedmodel must be
      # exported only by the chief worker.
      absl.logging.info("Exporting eval_savedmodel for TFMA.")
      tfma.export.export_eval_savedmodel(
          estimator=training_spec["estimator"],
          export_dir_base=path_utils.eval_model_dir(
              fn_args.model_run_dir
          ),
          eval_input_receiver_fn=training_spec[
              "eval_input_receiver_fn"
          ],
      )
  
      # TODO(b/160795287): Deprecate estimator based executor.
      # Copy serving and eval model from model_run to model artifact directory.
      serving_source = path_utils.serving_model_path(
          fn_args.model_run_dir
      )
      io_utils.copy_dir(serving_source, fn_args.serving_model_dir)
  
      eval_source = path_utils.eval_model_path(fn_args.model_run_dir)
      io_utils.copy_dir(eval_source, fn_args.eval_model_dir)
  
      absl.logging.info(
          "Training complete. Model written to %s",
          fn_args.serving_model_dir,
      )
      absl.logging.info(
          "Exported eval_savedmodel to %s.", fn_args.eval_model_dir
      )
  
imports: import absl
  import tensorflow
  from tensorflow import estimator
  import tensorflow_model_analysis
  import tensorflow_transform
  from tensorflow_transform.tf_metadata import schema_utils
  from tfx.components.trainer import executor
  from tfx.utils import io_utils
  from tfx.utils import path_utils
  from tfx_bsl.public.tfxio import TensorFlowDatasetOptions
  from tensorflow_metadata.proto.v0 import schema_pb2
label_desc: Use image node_id 10 for calling a global function with example usage: run_fn(fn_args) without return types