Missed TensorFlow Dev Summit? Check out the video playlist. Watch recordings

tfx.components.infra_validator.request_builder.RequestBuilder

View source on GitHub

RequestBuilder reads Examples and builds requests for model server.

tfx.components.infra_validator.request_builder.RequestBuilder(
    max_examples, model_name
)

You must read Examples using ReadFromXXX() method before building requests.

Usage:

builder = RequestBuilder(max_examples=10, model_name='mnist')
builder.ReadFromExamplesArtifact(examples, split_name='eval')
requests = builder.BuildClassificationRequests()

Attributes:

  • num_examples

Methods

BuildClassificationRequests

View source

BuildClassificationRequests()

Build ClassificationRequests from read Examples.

Returns:

A list of ClassificationRequest instance.

Raises:

  • RuntimeError: if you haven't read examples in advance.

BuildRegressionRequests

View source

BuildRegressionRequests()

Build RegressionRequests from read Examples.

Returns:

A list of RegressionRequest instance.

Raises:

  • RuntimeError: if you haven't read examples in advance.

ReadFromExamplesArtifact

View source

ReadFromExamplesArtifact(
    examples, split_name=None
)

Read up to self._max_examples tf.Examples from Examples artifact.

Args:

  • examples: Examples artifact.
  • split_name: Name of the split to read from given example.

SetSignatureName

View source

SetSignatureName(
    signature_name
)