Distributed model inference using TensorFlow Keras
This notebook demonstrates how to do distributed model inference using TensorFlow with ResNet-50 model and a Parquet file as input data.
This guide consists of the following sections:
- Prepare trained model and data for inference.
- Load pre-trained ResNet-50 model from keras.applications.
- Load the Flowers data and save to Parquet files.
- Load the data into Spark DataFrames.
- Run model inference via pandas UDF.
Note:
- The notebook runs without code changes on CPU and GPU-enabled clusters.
Define the input and output directories.
Prepare trained model and data for inference
Load the ResNet-50 Model and broadcast the weights.
Load the data and save the datasets to one Parquet file.
Load the data into Spark DataFrames
Load the data into Spark.
Run model inference via pandas UDF
Define the function to parse the input data.
Define the function for model inference.
Run the model inference and save the result to Parquet file.
Load and check the prediction results.
Clean up the directory.