Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue of conversion #64685

Closed
snehajhaveri01 opened this issue Mar 28, 2024 · 4 comments
Closed

issue of conversion #64685

snehajhaveri01 opened this issue Mar 28, 2024 · 4 comments
Assignees
Labels
comp:lite TF Lite related issues stat:awaiting response Status - Awaiting response from author TFLiteConverter For issues related to TFLite converter

Comments

@snehajhaveri01
Copy link

Error :
Traceback (most recent call last):
File "C:\Users\jhave\AppData\Local\Programs\Python\Python310\lib\site-packages\keras\src\engine\base_layer.py", line 868, in from_config
return cls(**config)
File "C:\Users\jhave\AppData\Local\Programs\Python\Python310\lib\site-packages\keras\src\utils\traceback_utils.py", line 70, in error_handler
raise e.with_traceback(filtered_tb) from None
File "C:\Users\jhave\AppData\Local\Programs\Python\Python310\lib\site-packages\keras\src\engine\input_layer.py", line 153, in init
raise ValueError(
ValueError: Unrecognized keyword arguments: ['batch_shape']

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "c:\Users\jhave\OneDrive\Documents\mood-shift\model.py", line 6, in
keras_model = tf.keras.models.load_model('mood-shift.keras')
File "C:\Users\jhave\AppData\Local\Programs\Python\Python310\lib\site-packages\keras\src\saving\saving_api.py", line 254, in load_model
return saving_lib.load_model(
File "C:\Users\jhave\AppData\Local\Programs\Python\Python310\lib\site-packages\keras\src\saving\saving_lib.py", line 281, in load_model
raise e
File "C:\Users\jhave\AppData\Local\Programs\Python\Python310\lib\site-packages\keras\src\saving\saving_lib.py", line 246, in load_model
model = deserialize_keras_object(
File "C:\Users\jhave\AppData\Local\Programs\Python\Python310\lib\site-packages\keras\src\saving\serialization_lib.py", line 728, in deserialize_keras_object
instance = cls.from_config(inner_config)
File "C:\Users\jhave\AppData\Local\Programs\Python\Python310\lib\site-packages\keras\src\engine\sequential.py", line 466, in from_config
layer = layer_module.deserialize(
File "C:\Users\jhave\AppData\Local\Programs\Python\Python310\lib\site-packages\keras\src\layers\serialization.py", line 276, in deserialize
return serialization_lib.deserialize_keras_object(
File "C:\Users\jhave\AppData\Local\Programs\Python\Python310\lib\site-packages\keras\src\saving\serialization_lib.py", line 609, in deserialize_keras_object
return deserialize_keras_object(
File "C:\Users\jhave\AppData\Local\Programs\Python\Python310\lib\site-packages\keras\src\saving\serialization_lib.py", line 728, in deserialize_keras_object
instance = cls.from_config(inner_config)
File "C:\Users\jhave\AppData\Local\Programs\Python\Python310\lib\site-packages\keras\src\engine\base_layer.py", line 870, in from_config
raise TypeError(
TypeError: Error when deserializing class 'InputLayer' using config={'batch_shape': [None, 30], 'dtype': 'float32', 'sparse': False, 'name': 'input_layer'}.

Exception encountered: Unrecognized keyword arguments: ['batch_shape']

@snehajhaveri01 snehajhaveri01 added the TFLiteConverter For issues related to TFLite converter label Mar 28, 2024
@Venkat6871 Venkat6871 added the comp:lite TF Lite related issues label Apr 1, 2024
@maximilianofried
Copy link

maximilianofried commented Apr 1, 2024

i had the same error!

I found a soultion using the keras legacy optimizer like this :

tf.keras.optimizers.legacy.SGD

python: 3.8.18
tensorflow: 2.13.0

@LakshmiKalaKadali
Copy link
Contributor

Hi @snehajhaveri01,

Please fill the template and share the reproducible code.

Thank You

@LakshmiKalaKadali LakshmiKalaKadali added the stat:awaiting response Status - Awaiting response from author label Apr 2, 2024
@snehajhaveri01
Copy link
Author

i had the same error!

I found a soultion using the keras legacy optimizer like this :

tf.keras.optimizers.legacy.SGD

python: 3.8.18 tensorflow: 2.13.0

i solved it the same way , thank you !

@MuhammadBilal848
Copy link

MuhammadBilal848 commented Apr 24, 2024

3.8.18

i had the same error!
I found a soultion using the keras legacy optimizer like this :
tf.keras.optimizers.legacy.SGD
python: 3.8.18 tensorflow: 2.13.0

i solved it the same way , thank you !

how'd you solve it? i could not maintain python version in colab. I tried it on my machine. I have .h5 model but it is not able to load and showing

TypeError: Error when deserializing class 'InputLayer' using config={'batch_shape': [None, 50], 'dtype': 'float32', 'sparse': False, 'name': 'input_layer_10'}.

Exception encountered: Unrecognized keyword arguments: ['batch_shape']

I tried making python version of 3.8.18 and when installed tensorflow==2.13.0. It caused some problems with numpy and when I resolved it. now it is still not resolving the issue.

@maximilianofried @snehajhaveri01

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:lite TF Lite related issues stat:awaiting response Status - Awaiting response from author TFLiteConverter For issues related to TFLite converter
Projects
None yet
Development

No branches or pull requests

5 participants