class_docstr: Local generic trainer executor for the TFX Trainer component.
  
  The Trainer executor supplements TensorFlow training with a component to
  enable warm-start training of any user-specified TF model. The Trainer is
  a library built on top of TensorFlow that is expected to be integrated into a
  custom user-specified binary.
  
  To include Trainer in a TFX pipeline, configure your pipeline similar to
  https://github.com/tensorflow/tfx/blob/master/tfx/examples/chicago_taxi_pipeline/taxi_pipeline_simple.py#L104.
  
  For more details on the Trainer component itself, please refer to
  https://tensorflow.org/tfx/guide/trainer.  For a tutorial on Tensorflow,
  please refer to https://www.tensorflow.org/tutorials.
  
  How to create a trainer callback function to be used by this Trainer executor:
  A model training can be executed by TFX by first creating a run_fn callback
  method that defines, trains an TF Model and saves it to the provided location,
  This becomes the basis of the Executor for GenericTrainer. This Executor will
  then execute the run_fn with correct parameters by resolving the input
  artifacts, output artifacts and execution properties.
class_docstr_tok: ["Local","generic","trainer","executor","for","the","TFX","Trainer","component",".","The","Trainer","executor","supplements","TensorFlow","training","with","a","component","to","enable","warm-start","training","of","any","user-specified","TF","model",".","The","Trainer","is","a","library","built","on","top","of","TensorFlow","that","is","expected","to","be","integrated","into","a","custom","user-specified","binary",".","To","include","Trainer","in","a","TFX","pipeline",",","configure","your","pipeline","similar","to","https",":","\/\/github.com\/tensorflow\/tfx\/blob\/master\/tfx\/examples\/chicago_taxi_pipeline\/taxi_pipeline_simple.py","#","L104",".","For","more","details","on","the","Trainer","component","itself",",","please","refer","to","https",":","\/\/tensorflow.org\/tfx\/guide\/trainer",".","For","a","tutorial","on","Tensorflow",",","please","refer","to","https",":","\/\/www.tensorflow.org\/tutorials",".","How","to","create","a","trainer","callback","function","to","be","used","by","this","Trainer","executor",":","A","model","training","can","be","executed","by","TFX","by","first","creating","a","run_fn","callback","method","that","defines",",","trains","an","TF","Model","and","saves","it","to","the","provided","location",",","This","becomes","the","basis","of","the","Executor","for","GenericTrainer",".","This","Executor","will","then","execute","the","run_fn","with","correct","parameters","by","resolving","the","input","artifacts",",","output","artifacts","and","execution","properties","."]
code: def _GetFnArgs(
      self,
      input_dict: Dict[str, List[types.Artifact]],
      output_dict: Dict[str, List[types.Artifact]],
      exec_properties: Dict[str, Any],
  ) -> fn_args_utils.FnArgs:
      if input_dict.get(standard_component_specs.HYPERPARAMETERS_KEY):
          hyperparameters_file = io_utils.get_only_uri_in_dir(
              artifact_utils.get_single_uri(
                  input_dict[
                      standard_component_specs.HYPERPARAMETERS_KEY
                  ]
              )
          )
          hyperparameters_config = json.loads(
              file_io.read_file_to_string(hyperparameters_file)
          )
      else:
          hyperparameters_config = None
  
      output_path = artifact_utils.get_single_uri(
          output_dict[standard_component_specs.MODEL_KEY]
      )
      serving_model_dir = path_utils.serving_model_dir(output_path)
      eval_model_dir = path_utils.eval_model_dir(output_path)
  
      model_run_dir = artifact_utils.get_single_uri(
          output_dict[standard_component_specs.MODEL_RUN_KEY]
      )
  
      # TODO(b/126242806) Use PipelineInputs when it is available in third_party.
      result = fn_args_utils.get_common_fn_args(
          input_dict, exec_properties
      )
      if result.custom_config and not isinstance(
          result.custom_config, dict
      ):
          raise ValueError(
              "custom_config in execution properties needs to be a "
              "dict. Got %s instead." % type(result.custom_config)
          )
      result.transform_output = result.transform_graph_path
      result.serving_model_dir = serving_model_dir
      result.eval_model_dir = eval_model_dir
      result.model_run_dir = model_run_dir
      result.schema_file = result.schema_path
      result.hyperparameters = hyperparameters_config
      return result
  
imports: import json
  import os
  from typing import Any, Dict, List
  import absl
  from tensorflow import estimator
  import tensorflow_model_analysis
  from tfx import types
  from tfx.components.trainer import constants
  from tfx.components.trainer import fn_args_utils
  from tfx.components.util import udf_utils
  from tfx.dsl.components.base import base_executor
  from tfx.dsl.io import fileio
  from tfx.types import artifact_utils
  from tfx.types import standard_component_specs
  from tfx.utils import deprecation_utils
  from tfx.utils import io_utils
  from tfx.utils import path_utils
  from tensorflow.python.lib.io import file_io
  from tensorflow_metadata.proto.v0 import schema_pb2
label_desc: Use image node_id 1 for calling the GenericExecutor obj's underlying member method code with example usage: obj._GetFnArgs(input_dict, output_dict, exec_properties) and returns: result