tfx icon indicating copy to clipboard operation
tfx copied to clipboard

TFX 1.16.0 Issue

Open vkarampudi opened this issue 1 year ago • 7 comments

Please comment or link any issues you find with TFX 1.16.0.

vkarampudi avatar Dec 12 '24 23:12 vkarampudi

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?

pritamdodeja avatar Dec 15 '24 03:12 pritamdodeja

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?

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!

pritamdodeja avatar Jan 16 '25 22:01 pritamdodeja

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!

nikelite avatar Jan 21 '25 06:01 nikelite

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!

pritamdodeja avatar Jan 28 '25 04:01 pritamdodeja

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

nikelite avatar Jan 31 '25 07:01 nikelite

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.

IzakMaraisTAL avatar May 28 '25 13:05 IzakMaraisTAL

https://github.com/tensorflow/tfx/issues/7773

aidandunlop avatar Sep 01 '25 14:09 aidandunlop