tfx.components.pusher.component.Pusher

View source on GitHub

Class Pusher

A TFX component to push validated TensorFlow models to a model serving platform.

Inherits From: BaseComponent

The Pusher component can be used to push an validated SavedModel from output of the Trainer component to TensorFlow Serving. The Pusher will check the validation results from the ModelValidator component before deploying the model. If the model has not been blessed, then the model will not be pushed.

Note: The executor for this component can be overriden to enable the model to be pushed to other serving platforms than tf.serving. The Cloud AI Platform custom executor provides an example how to implement this.

Example

  # Checks whether the model passed the validation steps and pushes the model
  # to a file destination if check passed.
  pusher = Pusher(
      model_export=trainer.outputs.output,
      model_blessing=model_validator.outputs.blessing,
      push_destination=pusher_pb2.PushDestination(
          filesystem=pusher_pb2.PushDestination.Filesystem(
              base_directory=serving_model_dir)))

__init__

View source

__init__(
    model_export=None,
    model_blessing=None,
    push_destination=None,
    custom_config=None,
    custom_executor_spec=None,
    model_push=None,
    model=None,
    instance_name=None
)

Construct a Pusher component.

Args:

  • model_export: A Channel of 'ModelExportPath' type, usually produced by Trainer component. Will be deprecated in the future for the model parameter.
  • model_blessing: A Channel of 'ModelBlessingPath' type, usually produced by ModelValidator component. required
  • push_destination: A pusher_pb2.PushDestination instance, providing info for tensorflow serving to load models. Optional if executor_class doesn't require push_destination.
  • custom_config: A dict which contains the deployment job parameters to be passed to cloud-based training platforms. The Kubeflow example contains an example how this can be used by custom executors.
  • custom_executor_spec: Optional custom executor spec.
  • model_push: Optional output 'ModelPushPath' channel with result of push.
  • model: Forwards compatibility alias for the 'model_exports' argument.
  • instance_name: Optional unique instance name. Necessary if multiple Pusher components are declared in the same pipeline.

Child Classes

class DRIVER_CLASS

class SPEC_CLASS

Properties

component_id

Component id, unique across all component instances in a pipeline.

If unique name is available, component_id will be: . otherwise, component_id will be:

Returns:

component id.

component_type

downstream_nodes

exec_properties

inputs

outputs

upstream_nodes

Methods

add_downstream_node

View source

add_downstream_node(downstream_node)

add_upstream_node

View source

add_upstream_node(upstream_node)

Class Members

  • EXECUTOR_SPEC