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

Hello, i use tensorflow-gpu==2.4.1, keras==2.2.4 ,but have the following error in load_model: #6

Open
191334391 opened this issue Feb 9, 2023 · 4 comments

Comments

@191334391
Copy link

Traceback (most recent call last):
File "data_visualization.py", line 65, in
model = keras.models.load_model(args.model, custom_objects=backbone.custom_objects)
File "/home/sunzong/anaconda3/envs/acrfnet04/lib/python3.6/site-packages/keras/engine/saving.py", line 419, in load_model
model = _deserialize_model(f, custom_objects, compile)
File "/home/sunzong/anaconda3/envs/acrfnet04/lib/python3.6/site-packages/keras/engine/saving.py", line 225, in _deserialize_model
model = model_from_config(model_config, custom_objects=custom_objects)
File "/home/sunzong/anaconda3/envs/acrfnet04/lib/python3.6/site-packages/keras/engine/saving.py", line 458, in model_from_config
return deserialize(config, custom_objects=custom_objects)
File "/home/sunzong/anaconda3/envs/acrfnet04/lib/python3.6/site-packages/keras/layers/init.py", line 55, in deserialize
printable_module_name='layer')
File "/home/sunzong/anaconda3/envs/acrfnet04/lib/python3.6/site-packages/keras/utils/generic_utils.py", line 145, in deserialize_keras_object
list(custom_objects.items())))
File "/home/sunzong/anaconda3/envs/acrfnet04/lib/python3.6/site-packages/keras/engine/network.py", line 1022, in from_config
process_layer(layer_data)
File "/home/sunzong/anaconda3/envs/acrfnet04/lib/python3.6/site-packages/keras/engine/network.py", line 1008, in process_layer
custom_objects=custom_objects)
File "/home/sunzong/anaconda3/envs/acrfnet04/lib/python3.6/site-packages/keras/layers/init.py", line 55, in deserialize
printable_module_name='layer')
File "/home/sunzong/anaconda3/envs/acrfnet04/lib/python3.6/site-packages/keras/utils/generic_utils.py", line 147, in deserialize_keras_object
return cls.from_config(config['config'])
File "/home/sunzong/anaconda3/envs/acrfnet04/lib/python3.6/site-packages/keras/engine/base_layer.py", line 1109, in from_config
return cls(**config)
File "/home/sunzong/anaconda3/envs/acrfnet04/lib/python3.6/site-packages/keras/legacy/interfaces.py", line 91, in wrapper
return func(*args, **kwargs)
File "/home/sunzong/anaconda3/envs/acrfnet04/lib/python3.6/site-packages/keras/engine/input_layer.py", line 87, in init
name=self.name)
File "/home/sunzong/anaconda3/envs/acrfnet04/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py", line 517, in placeholder
x = tf.placeholder(dtype, shape=shape, name=name)
AttributeError: module 'tensorflow' has no attribute 'placeholder'

@nacayu
Copy link
Owner

nacayu commented Feb 10, 2023

you can following this steps, it might be tf version problem
image

@191334391
Copy link
Author

thank you , I fix this error , but have the next error:

XXX lineno: 75, opcode: 0
Traceback (most recent call last):
File "data_visualization.py", line 129, in
main()
File "data_visualization.py", line 65, in main
model = keras.models.load_model(args.model, custom_objects=backbone.custom_objects)
File "C:\Users\sunheng.conda\envs\crfnet_new\lib\site-packages\keras\engine\saving.py", line 419, in load_model
model = _deserialize_model(f, custom_objects, compile)
File "C:\Users\sunheng.conda\envs\crfnet_new\lib\site-packages\keras\engine\saving.py", line 225, in deserialize_model
model = model_from_config(model_config, custom_objects=custom_objects)
File "C:\Users\sunheng.conda\envs\crfnet_new\lib\site-packages\keras\engine\saving.py", line 458, in model_from_config
return deserialize(config, custom_objects=custom_objects)
File "C:\Users\sunheng.conda\envs\crfnet_new\lib\site-packages\keras\layers_init
.py", line 55, in deserialize
printable_module_name='layer')
File "C:\Users\sunheng.conda\envs\crfnet_new\lib\site-packages\keras\utils\generic_utils.py", line 145, in deserialize_keras_object
list(custom_objects.items())))
File "C:\Users\sunheng.conda\envs\crfnet_new\lib\site-packages\keras\engine\network.py", line 1032, in from_config
process_node(layer, node_data)
File "C:\Users\sunheng.conda\envs\crfnet_new\lib\site-packages\keras\engine\network.py", line 991, in process_node
layer(unpack_singleton(input_tensors), **kwargs)
File "C:\Users\sunheng.conda\envs\crfnet_new\lib\site-packages\keras\engine\base_layer.py", line 457, in call
output = self.call(inputs, **kwargs)
File "C:\Users\sunheng.conda\envs\crfnet_new\lib\site-packages\keras\layers\core.py", line 687, in call
return self.function(inputs, **arguments)
File "../ssnn/model/architectures/vggmax.py", line 75, in func
SystemError: unknown opcode

@nacayu
Copy link
Owner

nacayu commented Feb 20, 2023

python version error. because your checkpoint is trained based on python3.5, so you should change python version to 3.5 intead of 3.6

@nacayu
Copy link
Owner

nacayu commented Feb 20, 2023

thank you , I fix this error , but have the next error:

XXX lineno: 75, opcode: 0 Traceback (most recent call last): File "data_visualization.py", line 129, in main() File "data_visualization.py", line 65, in main model = keras.models.load_model(args.model, custom_objects=backbone.custom_objects) File "C:\Users\sunheng.conda\envs\crfnet_new\lib\site-packages\keras\engine\saving.py", line 419, in load_model model = deserialize_model(f, custom_objects, compile) File "C:\Users\sunheng.conda\envs\crfnet_new\lib\site-packages\keras\engine\saving.py", line 225, in deserialize_model model = model_from_config(model_config, custom_objects=custom_objects) File "C:\Users\sunheng.conda\envs\crfnet_new\lib\site-packages\keras\engine\saving.py", line 458, in model_from_config return deserialize(config, custom_objects=custom_objects) File "C:\Users\sunheng.conda\envs\crfnet_new\lib\site-packages\keras\layers__init.py", line 55, in deserialize printable_module_name='layer') File "C:\Users\sunheng.conda\envs\crfnet_new\lib\site-packages\keras\utils\generic_utils.py", line 145, in deserialize_keras_object list(custom_objects.items()))) File "C:\Users\sunheng.conda\envs\crfnet_new\lib\site-packages\keras\engine\network.py", line 1032, in from_config process_node(layer, node_data) File "C:\Users\sunheng.conda\envs\crfnet_new\lib\site-packages\keras\engine\network.py", line 991, in process_node layer(unpack_singleton(input_tensors), **kwargs) File "C:\Users\sunheng.conda\envs\crfnet_new\lib\site-packages\keras\engine\base_layer.py", line 457, in call output = self.call(inputs, **kwargs) File "C:\Users\sunheng.conda\envs\crfnet_new\lib\site-packages\keras\layers\core.py", line 687, in call return self.function(inputs, **arguments) File "../ssnn/model/architectures/vggmax.py", line 75, in func SystemError: unknown opcode

https://blog.csdn.net/Sarah_LZ/article/details/86526968
this may help you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants