tfx.components.pusher.executor.Executor

View source on GitHub

Class Executor

TFX Pusher executor to push the new TF model to a filesystem target.

Inherits From: BaseExecutor

The Pusher component is used to deploy a validated model to a filesystem target or serving environment using tf.serving. Pusher depends on the outputs of ModelValidator to determine if a model is ready to push. A model is considered to be safe to push only if ModelValidator has marked it as BLESSED. A push action delivers the model exports produced by Trainer to the destination defined in the push_destination of the component config.

To include Pusher 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 tf.serving itself, please refer to https://tensorflow.org/tfx/guide/pusher. For a tutuorial on TF Serving, please refer to https://www.tensorflow.org/tfx/guide/serving.

__init__

View source

__init__(context=None)

Constructs a beam based executor.

Child Classes

class Context

Methods

CheckBlessing

View source

CheckBlessing(
    input_dict,
    output_dict
)

Check that model is blessed by upstream ModelValidator, or update output.

Args:

  • input_dict: Input dict from input key to a list of artifacts:
    • model_blessing: model blessing path from model_validator. Pusher looks for a file named 'BLESSED' to consider the model blessed and safe to push.
  • output_dict: Output dict from key to a list of artifacts, including:
    • model_push: A list of 'ModelPushPath' artifact of size one.

Returns:

True if the model is blessed by validator.

Do

View source

Do(
    input_dict,
    output_dict,
    exec_properties
)

Push model to target directory if blessed.

Args:

  • input_dict: Input dict from input key to a list of artifacts, including:
    • model_export: exported model from trainer.
    • model_blessing: model blessing path from model_validator. A push action delivers the model exports produced by Trainer to the destination defined in component config.
  • output_dict: Output dict from key to a list of artifacts, including:
    • model_push: A list of 'ModelPushPath' artifact of size one. It will include the model in this push execution if the model was pushed.
  • exec_properties: A dict of execution properties, including:
    • push_destination: JSON string of pusher_pb2.PushDestination instance, providing instruction of destination to push model.

Returns:

None