IDAES / examples

IDAES platform examples and tutorials
https://idaes-examples.readthedocs.io
Other
14 stars 34 forks source link

Resolve Keras File Format Issues #88

Open bpaul4 opened 3 months ago

bpaul4 commented 3 months ago

TensorFlow updated to version 2.16.1 on March 8, 2024. Python 3.9+ tests in the main idaes-pse repository that install the latest package and run examples now throw errors similar to the message below:

E           ValueError: File format not supported: filepath=D:\a\idaes-pse\idaes-pse\idaes\core\surrogate\plotting\tests\keras_surrogate. Keras 3 only supports V3 `.keras` files and legacy H5 format files (`.h5` extension). Note that the legacy SavedModel format is not supported by `load_model()` in Keras 3. In order to reload a TensorFlow SavedModel as an inference-only layer in Keras 3, use `keras.layers.TFSMLayer(D:\a\idaes-pse\idaes-pse\idaes\core\surrogate\plotting\tests\keras_surrogate, call_endpoint='serving_default')` (note that your `call_endpoint` might have a different name).

Examples that use Keras should be updated accordingly.

bpaul4 commented 3 months ago

Related to https://github.com/IDAES/idaes-pse/issues/1369.