Calling a Transformer ML Model directly via SQL to predict sentiments
Tutorial on applying a Hugging Face Machine Learning model directly to some table data via SparkSql UDFs and MLflow
MLflow and Apache Spark shine for manipulating your data. Let’s focus on showing how an already existing ML model, here the popular distilbert, can be made available in SQL.
Democratize your ML: SQL is much simpler to use than regular Python, what if the model was easily available to your SQL user base?
Here is the high level architecture:
First we pull the model from the Hugging Face and register it in MLflow:
Then via this Notebook we demo how to make the model available as a function that can directly be called in SQL queries.
The code is available in this demo repository. Next time we will see how to build our own model!
And that’s it, happy predicting!