public class RunInference<OutputT>
extends org.apache.beam.sdk.transforms.PTransform<org.apache.beam.sdk.values.PCollection<?>,org.apache.beam.sdk.values.PCollection<OutputT>>
RunInference.| Modifier and Type | Method and Description |
|---|---|
org.apache.beam.sdk.values.PCollection<OutputT> |
expand(org.apache.beam.sdk.values.PCollection<?> input) |
static RunInference<org.apache.beam.sdk.values.Row> |
of(java.lang.String modelLoader,
org.apache.beam.sdk.schemas.Schema.FieldType exampleType,
org.apache.beam.sdk.schemas.Schema.FieldType inferenceType)
Instantiates a multi-language wrapper for a Python RunInference with a given model loader.
|
static RunInference<org.apache.beam.sdk.values.Row> |
of(java.lang.String modelLoader,
org.apache.beam.sdk.schemas.Schema schema)
Instantiates a multi-language wrapper for a Python RunInference with a given model loader.
|
static <KeyT> RunInference<org.apache.beam.sdk.values.KV<KeyT,org.apache.beam.sdk.values.Row>> |
ofKVs(java.lang.String modelLoader,
org.apache.beam.sdk.schemas.Schema.FieldType exampleType,
org.apache.beam.sdk.schemas.Schema.FieldType inferenceType,
org.apache.beam.sdk.coders.Coder<KeyT> keyCoder)
Similar to
RunInference#of(String, FieldType, FieldType) but the input is a PCollection of KVs. |
static <KeyT> RunInference<org.apache.beam.sdk.values.KV<KeyT,org.apache.beam.sdk.values.Row>> |
ofKVs(java.lang.String modelLoader,
org.apache.beam.sdk.schemas.Schema schema,
org.apache.beam.sdk.coders.Coder<KeyT> keyCoder)
|
RunInference<OutputT> |
withExpansionService(java.lang.String expansionService)
Sets an expansion service endpoint for RunInference.
|
RunInference<OutputT> |
withExtraPackages(java.util.List<java.lang.String> extraPackages)
Specifies any extra packages required by the RunInference model handler.
|
RunInference<OutputT> |
withKwarg(java.lang.String key,
java.lang.Object arg)
Sets keyword arguments for the model loader.
|
addAnnotation, compose, compose, getAdditionalInputs, getAnnotations, getDefaultOutputCoder, getDefaultOutputCoder, getDefaultOutputCoder, getKindString, getName, getResourceHints, populateDisplayData, setDisplayData, setResourceHints, toString, validate, validatepublic static RunInference<org.apache.beam.sdk.values.Row> of(java.lang.String modelLoader, org.apache.beam.sdk.schemas.Schema.FieldType exampleType, org.apache.beam.sdk.schemas.Schema.FieldType inferenceType)
modelLoader - A Python callable for a model loader class object.exampleType - A schema field type for the example column in output rows.inferenceType - A schema field type for the inference column in output rows.RunInference for the given model loader.public static <KeyT> RunInference<org.apache.beam.sdk.values.KV<KeyT,org.apache.beam.sdk.values.Row>> ofKVs(java.lang.String modelLoader, org.apache.beam.sdk.schemas.Schema.FieldType exampleType, org.apache.beam.sdk.schemas.Schema.FieldType inferenceType, org.apache.beam.sdk.coders.Coder<KeyT> keyCoder)
RunInference#of(String, FieldType, FieldType) but the input is a PCollection of KVs.
Also outputs a PCollection of KVs of the same key type.
For example, use this if you are using Python KeyedModelHandler as the model
handler.
KeyT - input and output Key type. Inferred by the provided coder.modelLoader - A Python callable for a model loader class object.exampleType - A schema field type for the example column in output rows.inferenceType - A schema field type for the inference column in output rows.keyCoder - a Coder for the input and output Key type.RunInference for the given model loader.public static RunInference<org.apache.beam.sdk.values.Row> of(java.lang.String modelLoader, org.apache.beam.sdk.schemas.Schema schema)
modelLoader - A Python callable for a model loader class object.schema - A schema for output rows.RunInference for the given model loader.public static <KeyT> RunInference<org.apache.beam.sdk.values.KV<KeyT,org.apache.beam.sdk.values.Row>> ofKVs(java.lang.String modelLoader, org.apache.beam.sdk.schemas.Schema schema, org.apache.beam.sdk.coders.Coder<KeyT> keyCoder)
KeyT - input and output Key type. Inferred by the provided coder.modelLoader - A Python callable for a model loader class object.schema - A schema for output rows.keyCoder - a Coder for the input and output Key type.RunInference for the given model loader.public RunInference<OutputT> withKwarg(java.lang.String key, java.lang.Object arg)
RunInference with keyword arguments.public RunInference<OutputT> withExtraPackages(java.util.List<java.lang.String> extraPackages)
This should only be specified when using the default expansion service, i.e. when not using
withExpansionService(String) to provide an expansion service.
The package can either be a PyPi package or the path to a locally available Python package.
For model handlers provided by Beam Python SDK, the implementation will automatically try to infer correct packages needed, so this may be omitted.
extraPackages - a list of PyPi packages. May include the version.RunInference with extra packages.public RunInference<OutputT> withExpansionService(java.lang.String expansionService)
expansionService - A URL for a Python expansion service.RunInference for the given expansion service endpoint.