model_runner
ModelRunner
This class abstracts all the potentially different predict
method signatures into a single API that can be used by the model servers.
When initializing the model, pass in a Python function that adheres to any of the defined signatures indicated by chassis.ftypes.PredictFunction type alias. If your model supports batch predictions, set the batch_size
to the number of inputs that your model can process at once.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
predict_fn | PredictFunction | Single predict function of type | required |
batch_size | int | Integer representing the batch size your model supports. If your model does not support batching, the default value is 1 | 1 |
is_legacy_fn | bool | If | False |
load classmethod
Convenience function used by model servers to load a cloudpickle'd model in the model container.
predict
Performs an inference against the model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
inputs | Sequence[Mapping[str, bytes]] | Mapping of input name (str) to input data (bytes) which the predict function is expected to process for inference. | required |
Returns:
Type | Description |
---|---|
Sequence[Mapping[str, bytes]] | List of outputs the |