<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Is Feature Store packaged model compatible with Spark UDF? in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/is-feature-store-packaged-model-compatible-with-spark-udf/m-p/3060#M242</link>
    <description>&lt;P&gt;Hi @Chengcheng Guo​&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Great to meet you, and thanks for your question! &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let's see if your peers in the community have an answer to your question. Thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 17 Jun 2023 09:34:31 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2023-06-17T09:34:31Z</dc:date>
    <item>
      <title>Is Feature Store packaged model compatible with Spark UDF?</title>
      <link>https://community.databricks.com/t5/data-engineering/is-feature-store-packaged-model-compatible-with-spark-udf/m-p/3059#M241</link>
      <description>&lt;P&gt;Hi, I tried to deploy a Feature Store packaged model into Delta Live Table using mlflow.pyfunc.spark_udf in Azure Databricks. &lt;/P&gt;&lt;P&gt;This model is built by Databricks autoML with joined Feature Table inside it.&lt;/P&gt;&lt;P&gt;And I'm trying to make prediction using the following code in my notebook. (and also DLT)&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;# Load model as a Spark UDF. Override result_type if the model does not return double values.
loaded_model = mlflow.pyfunc.spark_udf(spark, model_uri=logged_model, result_type='double', env_manager='virtualenv')
&amp;nbsp;
# Predict on a Spark DataFrame.
df.withColumn('predictions', loaded_model(struct(*map(col, df.columns))))&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;​&lt;/P&gt;&lt;P&gt;But I get the following error:&lt;/P&gt;&lt;P&gt;Exception: Internal error: Online feature table information could not be found for feature tables.&lt;/P&gt;&lt;P&gt;This feature table does exist and inference using &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;predictions_df = fs.score_batch(logged_model,  batch_input_df, result_type="double")&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;fs.score_batch works. With a warning about Spark UDF as following:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;WARNING mlflow.pyfunc: Calling `spark_udf()` with `env_manager="local"` does not recreate the same environment that was used during training, which may lead to errors or inaccurate predictions. We recommend specifying `env_manager="conda"`, which automatically recreates the environment that was used to train the model and performs inference in the recreated environment.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I also tried another Feature Store packaged model which packed by myself but it comes with the same error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So my question is:&lt;/P&gt;&lt;P&gt;Is the spark_udf function compatible with Feature Store packaged model at this moment?&lt;/P&gt;&lt;P&gt;If it does, how should I fix this error and deploy it to DLT?&lt;/P&gt;&lt;P&gt;​&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2023 07:21:56 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/is-feature-store-packaged-model-compatible-with-spark-udf/m-p/3059#M241</guid>
      <dc:creator>Chengcheng</dc:creator>
      <dc:date>2023-06-15T07:21:56Z</dc:date>
    </item>
    <item>
      <title>Re: Is Feature Store packaged model compatible with Spark UDF?</title>
      <link>https://community.databricks.com/t5/data-engineering/is-feature-store-packaged-model-compatible-with-spark-udf/m-p/3060#M242</link>
      <description>&lt;P&gt;Hi @Chengcheng Guo​&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Great to meet you, and thanks for your question! &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let's see if your peers in the community have an answer to your question. Thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 17 Jun 2023 09:34:31 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/is-feature-store-packaged-model-compatible-with-spark-udf/m-p/3060#M242</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-06-17T09:34:31Z</dc:date>
    </item>
  </channel>
</rss>

