Prediction and inference

Beam provides different ways to implement inference as part of your pipeline. You can run your ML model directly in your pipeline and apply it on big scale datasets, both in batch and streaming pipelines.

Use the RunInference API

Pydoc Pydoc

Javadoc Javadoc

The RunInference API is available with the Beam Python SDK versions 2.40.0 and later. You can use Apache Beam with the RunInference API to use machine learning (ML) models to do local and remote inference with batch and streaming pipelines. Starting with Apache Beam 2.40.0, PyTorch and Scikit-learn frameworks are supported. Tensorflow models are supported through tfx-bsl. For more deatils about using RunInference with Python, see About Beam ML.

The RunInference API is available with the Beam Java SDK versions 2.41.0 and later through Apache Beam’s Multi-language Pipelines framework. For information about the Java wrapper transform, see To try it out, see the Java Sklearn Mnist Classification example.

You can create multiple types of transforms using the RunInference API: the API takes multiple types of setup parameters from model handlers, and the parameter type determines the model implementation.

I want to use the RunInference transformModify a Python pipeline to use an ML model
I want to use RunInference with PyTorchUse RunInference with PyTorch
I want to use RunInference with SklearnUse RunInference with Sklearn
I want to use pre-trained models (PyTorch, Scikit-learn, or TensorFlow)Use pre-trained models

Use cases

I want to build a pipeline with multiple modelsMulti-Model Pipelines
I want to build a custom model handler with TensorRTUse TensorRT with RunInference
I want to use LLM inferenceLarge Language Model Inference