Open wwwind opened 3 months ago
I had the same issue. I just switched to tensorflow_model_optimization.python.core.keras.compat
. The code didn’t require much modification.
TFMOT is using Keras version 2 which is only used by default until TensorFlow version 2.15.
pip install tf_keras
os.environ['TF_USE_LEGACY_KERAS'] = "1"
before importing TensorFlow in your script to make it use Keras v2.For more details check: https://keras.io/getting_started/#tensorflow--keras-2-backwards-compatibility
Prior to filing: check that this should be a bug instead of a feature request. Everything supported, including the compatible versions of TensorFlow, is listed in the overview page of each technique. For example, the overview page of quantization-aware training is here. An issue for anything not supported should be a feature request.
Describe the bug A clear and concise description of what the bug is.
System information
TensorFlow version (installed from source or binary): 2.17.0
TensorFlow Model Optimization version (installed from source or binary): 0.8.0
Python version: 3.10
Describe the expected behavior
Describe the current behavior Failed with the error
Code to reproduce the issue
Screenshots If applicable, add screenshots to help explain your problem.
Additional context My model is defined using tensorflow.keras instead of tensorflow_model_optimization.python.core.keras.compat like in tutorials and this leads to this error as model is not recognized as Sequential, although it is Sequential.