Dataflow ML
Dataflow ML lets you use Dataflow to deploy and manage complete machine learning (ML) pipelines. Use ML models to do local and remote inference with batch and streaming pipelines. Use data processing tools to prepare your data for model training and to process the results of the models.
Prediction and inference
Whether you want to classify images in real-time, run remote inference calls, or build a custom model handler, you can find complete Dataflow ML examples.
Data processing
Use the
MLTransform class to preprocess data for machine learning (ML) workflows. By combining multiple data processing transforms in one class, MLTransform streamlines the process of applying Apache Beam ML data processing transforms to your workflow.
with pipeline as p: predictions = ( p | beam.ReadFromSource('a_source') | RunInference(MODEL_HANDLER))
RunInference transform
Using
RunInference is as straightforward as adding the transform code to your pipeline. In this example, MODEL_HANDLER is the model configuration object.
with beam.Pipeline() as p: transformed_data = ( p | beam.Create(data) | MLTransform(...) | beam.Map(print))
MLTransform code
To prepare your data for training ML models, use
MLTransform in your pipeline. MLTransform wraps multiple data processing transforms in one class, letting you use one class for a variety of preprocessing tasks.
Prediction and inference with pre-trained models
I have a Pytorch model
Use a pre-trained model with Pytorch.
I have a scikit-learn model
Use a pre-trained model with scikit-learn.
I have a TensorFlow model
Use a pre-trained model with TensorFlow.
I have an Agent Platform (previously Vertex AI) model handler
Apache Beam has built-in support for sending requests to a remotely deployed Agent Platform endpoint. This notebook shows how to use the Apache Beam
RunInference transform for image classification with Agent Platform.
I want to use multiple differently-trained models in my pipeline
Use the
RunInference transform with a keyed model handler to use multiple models in the same RunInference transform.