A TFX component to validate the model against the serving infrastructure.
Inherits From: BaseComponent
, BaseNode
tfx.v1.components.InfraValidator(
model: tfx.v1.types.BaseChannel
,
serving_spec: tfx.v1.proto.ServingSpec
,
examples: Optional[tfx.v1.types.BaseChannel
] = None,
request_spec: Optional[tfx.v1.proto.RequestSpec
] = None,
validation_spec: Optional[tfx.v1.proto.ValidationSpec
] = None
)
An infra validation is done by loading the model to the exactly same serving binary that is used in production, and additionaly sending some requests to the model server. Such requests can be specified from Examples artifact.
Examples
Full example using TensorFlowServing binary running on local docker.
infra_validator = InfraValidator(
model=trainer.outputs['model'],
examples=test_example_gen.outputs['examples'],
serving_spec=ServingSpec(
tensorflow_serving=TensorFlowServing( # Using TF Serving.
tags=['latest']
),
local_docker=LocalDockerConfig(), # Running on local docker.
),
validation_spec=ValidationSpec(
max_loading_time_seconds=60,
num_tries=5,
),
request_spec=RequestSpec(
tensorflow_serving=TensorFlowServingRequestSpec(),
num_examples=1,
)
)
Minimal example when running on Kubernetes.
infra_validator = InfraValidator(
model=trainer.outputs['model'],
examples=test_example_gen.outputs['examples'],
serving_spec=ServingSpec(
tensorflow_serving=TensorFlowServing(
tags=['latest']
),
kubernetes=KubernetesConfig(), # Running on Kubernetes.
),
)
Component outputs
contains:
blessing
: Channel of typestandard_artifacts.InfraBlessing
that contains the validation result.
See the InfraValidator guide for more details.
Args | |
---|---|
model
|
A BaseChannel of ModelExportPath type, usually produced by
Trainer component.
required
|
serving_spec
|
A ServingSpec configuration about serving binary and test
platform config to launch model server for validation. required
|
examples
|
A BaseChannel of ExamplesPath type, usually produced by
ExampleGen component.
If not specified, InfraValidator does not issue requests for
validation.
|
request_spec
|
Optional RequestSpec configuration about making requests
from examples input. If not specified, InfraValidator does not issue
requests for validation.
|
validation_spec
|
Optional ValidationSpec configuration.
|
Attributes | |
---|---|
outputs
|
Component's output channel dict. |
Methods
with_node_execution_options
with_node_execution_options(
node_execution_options: utils.NodeExecutionOptions
) -> typing_extensions.Self
Class Variables | |
---|---|
POST_EXECUTABLE_SPEC |
None
|
PRE_EXECUTABLE_SPEC |
None
|