Closed Leli1024 closed 3 weeks ago
UPDATE:
Adding the following code works as a workaround
import os
os.environ["TF_USE_LEGACY_KERAS"]="1"
Hi @Leli1024 ,
This issue is resolved in tf 2.17, can you please retry your code with tf version 2.17 and let me know if it works for you.
This issue is stale because it has been open for 7 days with no activity. It will be closed if no further activity occurs. Thank you.
This issue was closed because it has been inactive for 7 days since being marked as stale. Please reopen if you'd like to work on this further.
Im using the latest version of tensorflow installed from PIP
I'm getting the error: File "/Users/andrewattard/Downloads/Foodity Dataset/main.py", line 88, in
tflite_model = converter.convert()
^^^^^^^^^^^^^^^^^^^
File "/Users/andrewattard/miniforge3/envs/foodity/lib/python3.12/site-packages/tensorflow/lite/python/lite.py", line 1175, in wrapper
return self._convert_and_export_metrics(convert_func, *args, kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/andrewattard/miniforge3/envs/foodity/lib/python3.12/site-packages/tensorflow/lite/python/lite.py", line 1129, in _convert_and_export_metrics
result = convert_func(self, *args, *kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/andrewattard/miniforge3/envs/foodity/lib/python3.12/site-packages/tensorflow/lite/python/lite.py", line 1641, in convert
self._freeze_keras_model()
File "/Users/andrewattard/miniforge3/envs/foodity/lib/python3.12/site-packages/tensorflow/lite/python/convert_phase.py", line 215, in wrapper
raise error from None # Re-throws the exception.
^^^^^^^^^^^^^^^^^^^^^
File "/Users/andrewattard/miniforge3/envs/foodity/lib/python3.12/site-packages/tensorflow/lite/python/convert_phase.py", line 205, in wrapper
return func(args, kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/Users/andrewattard/miniforge3/envs/foodity/lib/python3.12/site-packages/tensorflow/lite/python/lite.py", line 1582, in _freeze_keras_model
input_signature = _model_input_signature(
^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/andrewattard/miniforge3/envs/foodity/lib/python3.12/site-packages/tensorflow/lite/python/tflite_keras_util.py", line 84, in model_input_signature
input_specs = model._get_save_spec( # pylint: disable=protected-access
^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Sequential' object has no attribute '_get_save_spec'. Did you mean: '_set_save_spec'?
My code is