TFX 1.16.0 Issue
Please comment or link any issues you find with TFX 1.16.0.
In TFX 1.15.1, I could use
model.save(fn_args.serving_model_dir, save_format='tf', signatures=signatures)
and the model would work as expected in tensorflow serving. Given that keras3 has deprecated the SavedModel format as per https://keras.io/guides/serialization_and_saving/, specifically, "The only supported format in Keras 3 is the "Keras v3" format, which uses the .keras extension.",
The use of
tf.saved_model.save(model, export_dir=fn_args.serving_model_dir, signatures=signatures)
does not work as expected in tensorflow serving. What is the right way to store the model such that it can served?
Secondly, does the solution for the above also solve it for the InfraValidator component?
In TFX 1.15.1, I could use
model.save(fn_args.serving_model_dir, save_format='tf', signatures=signatures)and the model would work as expected in tensorflow serving. Given that keras3 has deprecated the
SavedModelformat as per https://keras.io/guides/serialization_and_saving/, specifically, "The only supported format in Keras 3 is the "Keras v3" format, which uses the .keras extension.",The use of
tf.saved_model.save(model, export_dir=fn_args.serving_model_dir, signatures=signatures)does not work as expected in tensorflow serving. What is the right way to store the model such that it can served?
Secondly, does the solution for the above also solve it for the
InfraValidatorcomponent?
Hello, can you please advise about this, as soon I'll have to use the path foundation model released by Google, and that model uses the latest version of XLA/Tensorflow, and this SavedModel thing would be a blocker for me. Thank you!
Hi @pritamdodeja, sorry for the late response.
TFX and underlying libraries are not currently supporting Keras 3, though we support TF 1.16.
In TF 1.16, model.save() api is deprecated, and you should use tf.saved_model API.
You can find more information in https://www.tensorflow.org/guide/saved_model
TF saved model should be compatible with TF serving, as both follows TF saved model format. You may be able to check some codes without TFX pipeline or components, and see if it's model issue or TFX component issue.
saved_model_cli will be the useful tool to investigate this.
Thanks!
Hello @nikelite - are there any other blockers other than keras3 dropping support for SavedModel format? I am sticking with 1.15 till things stabilize/integrate with respect to keras3. Thank you!
AFAIK, TensorFlow 2.16.1 still supports Keras 2.0-style saved models via its low-level APIs, and TFX 1.16 uses TensorFlow 2.16.1 with Keras 2.0.
The following TensorFlow release notes explain how Keras 2.0 can be used with TensorFlow 2.16.1. Thanks! https://github.com/tensorflow/tensorflow/releases/tag/v2.16.1
TFX and underlying libraries are not currently supporting Keras 3, though we support TF 1.16.
This information should be highlighted in the release notes!
I just spent a day trying to figure out why the BulkInferrer could run my model (saved with tf.saved_model.save) after upgrading to TFX1.16 and porting my Keras2 code to Keras3.
The following TensorFlow release notes explain how Keras 2.0 can be used with TensorFlow 2.16.1
Thanks for the links.
https://github.com/tensorflow/tfx/issues/7773