You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am currently transitioning from tfdf to ydf for training Random Forest models. I need to save the models in the SavedModel format for Vertex AI predictions, still requiring me to use tfdf. I am thus using the following versions in my training pipeline:
The TF version is fixed to 2.16.1 since tfdf==1.9.1 is only compatible with that version of TF (cf. compatibility table)
I use tf-keras to be able to use Keras 2.x since Keras 3.x is now the default in TF 2.16.1
After training, I save my model in the Keras SavedModel format and would like to deploy it in Vertex AI for making predictions. However, the latest TF version available in Vertex AI as a prebuilt container is 2.15.
Do you know if there is a plan to include a prebuilt container with TF 2.16.1 to allow for models trained with YDF to be used in Vertex AI ?
If not, is there an other way to circumvent the collision issue (I cannot force install ydf as my dependencies are resolved with poetry).
Thank you for your help and for the great lib :),
Best,
Nasser
The text was updated successfully, but these errors were encountered:
Have you tried if it "just works" with Tensorflow 2.15.0, tfdf 1.8.1 and ydf 0.9.0?
I just tried the following on Google colab after installing these versions and everything worked fine. I think the proto collision was separately solved on the YDF side.
import ydf
import tensorflow_decision_forests as tfdf
import tensorflow as tf
import pandas as pd
import numpy as np
print(f"Tensorflow version is {tf.__version__}")
print(f"Tensorflow Decision Forests version is {tfdf.__version__}")
print(f"YDF version is {ydf.__version__}")
# Tensorflow version is 2.15.0
# Tensorflow Decision Forests version is 1.8.1
# YDF version is 0.9.0
ds_path = "https://raw.githubusercontent.com/google/yggdrasil-decision-forests/main/yggdrasil_decision_forests/test_data/dataset"
train_ds = pd.read_csv(f"{ds_path}/gaussians_train.csv")
test_ds = pd.read_csv(f"{ds_path}/gaussians_test.csv")
ydf_model = ydf.RandomForestLearner(label="label", task=ydf.Task.CLASSIFICATION).train(train_ds)
ydf_model.to_tensorflow_saved_model('my_tfdf_model')
tfdf_model = tf.keras.models.load_model('my_tfdf_model')
ydf_pred = ydf_model.predict(test_ds)
test_tf_ds = tfdf.keras.pd_dataframe_to_tf_dataset(test_ds, label="label")
tfdf_pred = tfdf_model.predict(test_tf_ds).flatten()
np.all(tfdf_pred == ydf_pred)
# True
Thank you for your quick reply and looking into this ! It works with those versions but the collision error happens at the import of ydf depending on the order of install of ydf and tfdf (cf. here for more details). The proto collision was actually fixed in tfdf==1.9.1 (release notes) as tfdf depends on ydf there.
But I cannot force install ydf as my dependencies are resolved with poetry as suggested here (and the error message in ydf)
Hi all,
I am currently transitioning from
tfdf
toydf
for training Random Forest models. I need to save the models in theSavedModel
format for Vertex AI predictions, still requiring me to usetfdf
. I am thus using the following versions in my training pipeline:tfdf==1.9.1
which fixes the collision issue with YDFtfdf==1.9.1
is only compatible with that version of TF (cf. compatibility table)tf-keras
to be able to use Keras 2.x since Keras 3.x is now the default in TF 2.16.1After training, I save my model in the Keras
SavedModel
format and would like to deploy it in Vertex AI for making predictions. However, the latest TF version available in Vertex AI as a prebuilt container is 2.15.Do you know if there is a plan to include a prebuilt container with TF 2.16.1 to allow for models trained with YDF to be used in Vertex AI ?
If not, is there an other way to circumvent the collision issue (I cannot force install
ydf
as my dependencies are resolved withpoetry
).Thank you for your help and for the great lib :),
Best,
Nasser
The text was updated successfully, but these errors were encountered: