A TFX component to do batch inference on a model with unlabelled examples.
Inherits From: BaseBeamComponent, BaseComponent, BaseNode
tfx.v1.components.BulkInferrer(
examples: tfx.v1.types.BaseChannel,
model: Optional[tfx.v1.types.BaseChannel] = None,
model_blessing: Optional[tfx.v1.types.BaseChannel] = None,
data_spec: Optional[Union[tfx.v1.proto.DataSpec, tfx.v1.dsl.experimental.RuntimeParameter]] = None,
model_spec: Optional[Union[tfx.v1.proto.ModelSpec, tfx.v1.dsl.experimental.RuntimeParameter]] = None,
output_example_spec: Optional[Union[bulk_inferrer_pb2.OutputExampleSpec, data_types.
RuntimeParameter]] = None
)
BulkInferrer consumes examples data and a model, and produces the inference results to an external location as PredictionLog proto.
BulkInferrer will infer on validated model.
Example
# Uses BulkInferrer to inference on examples.
bulk_inferrer = BulkInferrer(
examples=example_gen.outputs['examples'],
model=trainer.outputs['model'])
Component outputs contains:
inference_result: Channel of typestandard_artifacts.InferenceResultto store the inference results.output_examples: Channel of typestandard_artifacts.Examplesto store the output examples. This is optional controlled byoutput_example_spec.
See the BulkInferrer guide for more details.
Args | |
|---|---|
examples
|
A BaseChannel of type standard_artifacts.Examples, usually
produced by an ExampleGen component. required
|
model
|
A BaseChannel of type standard_artifacts.Model, usually produced
by a Trainer component.
|
model_blessing
|
A BaseChannel of type standard_artifacts.ModelBlessing,
usually produced by a ModelValidator component.
|
data_spec
|
bulk_inferrer_pb2.DataSpec instance that describes data selection. |
model_spec
|
bulk_inferrer_pb2.ModelSpec instance that describes model specification. |
output_example_spec
|
bulk_inferrer_pb2.OutputExampleSpec instance, specify if you want BulkInferrer to output examples instead of inference result. |
Attributes | |
|---|---|
outputs
|
Component's output channel dict. |
Methods
with_beam_pipeline_args
with_beam_pipeline_args(
beam_pipeline_args: Iterable[Union[str, placeholder.Placeholder]]
) -> 'BaseBeamComponent'
Add per component Beam pipeline args.
| Args | |
|---|---|
beam_pipeline_args
|
List of Beam pipeline args to be added to the Beam executor spec. |
| Returns | |
|---|---|
| the same component itself. |
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
|