![]() |
Local estimator based trainer executor used by the TFX Trainer component.
Inherits From: GenericExecutor
, BaseExecutor
tfx.components.trainer.executor.Executor(
context: Optional[tfx.dsl.components.base.base_executor.BaseExecutor.Context
] = None
)
How to create a trainer callback function to be used by this Trainer executor: An estimator can be executed by TFX by first creating a trainer_fn callback method that returns an estimator and some additional parameters, similar to https://github.com/tensorflow/tfx/blob/master/tfx/examples/chicago_taxi_pipeline/taxi_utils.py#L285 This becomes the basis of the new Executor for Trainer. This Executor will then train and evaluate this estimator using the tf.estimator.train_and_evaluate API to train locally.
Child Classes
Methods
Do
Do(
input_dict: Dict[Text, List[types.Artifact]],
output_dict: Dict[Text, List[types.Artifact]],
exec_properties: Dict[Text, Any]
) -> None
Uses a user-supplied tf.estimator to train a TensorFlow model locally.
The Trainer Executor invokes a training_fn callback function provided by the user via the module_file parameter. With the tf.estimator returned by this function, the Trainer Executor then builds a TensorFlow model using the user-provided tf.estimator.
Args | |
---|---|
input_dict
|
Input dict from input key to a list of ML-Metadata Artifacts.
|
output_dict
|
Output dict from output key to a list of Artifacts.
|
exec_properties
|
A dict of execution properties.
|
Returns | |
---|---|
None |
Raises | |
---|---|
ValueError
|
When neither or both of 'module_file' and 'trainer_fn' are present in 'exec_properties'. |