I spend the last 5 hours or so trying to get TF 2.0 keras API working with the tf.lookup API. My training script also uses DataBricks and mlflow.keras
. MLFlow requires that the model be serialized, which I think is what is causing issues for me. The question is: how to use tf.lookup tables with TensorFlow 2.0 keras Model API and MLFlow.
I was getting keras issues with serialization when trying to use the functional Keras API with table.lookup directly:
table = tf.lookup.StaticVocabularyTable(tf.lookup.TextFileInitializer(vocab_path, tf.string, 0, tf.int64, 1, delimiter=","), 1)
categorical_indices = table.lookup(categorical_input)
Wrapping the above call in a tf.keras.layers.Lambda
layer didn't help.
I was getting errors related to resource handles or missing tf
variable...