Closed smarimariem closed 1 year ago
Hi, could you please try the solution suggested in this link and let us know if this helps. Thanks!
Hi, could you please try the solution suggested in this link and let us know if this helps. Thanks!
I 've try this :
model = keras.models.load_model("my_h5_model.h5") tf.saved_model.save(model, "tmp_model") == It works , but the next instruction didn't work and i 've got the same error python3 -m tf2onnx.convert --saved-model tmp_model --output "model.onnx"
The error: slot_variable = optimizer_object.add_slot( AttributeError: '_UserObject' object has no attribute 'add_slot'
I'm running into this same issue. Attempting to convert model to onnx.
AttributeError: '_UserObject' object has no attribute 'add_slot'
I willing to investigate this issue.
Hi @smarimariem ,
I am not sure this issue is related to Tensorflow. Since you are using tf2onxx
library which is not related to TF and we are not maintaining tf2onxx
.
If you feel this is a bug in Tensorflow, please submit a code snippet that can reproduce similar error related to tensorflow without external libraries involved and we will happily look into the issue.
Thanks!
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.
Please make sure that this is a build/installation issue. As per our GitHub Policy, we only address code/doc bugs, performance issues, feature requests and build/installation issues on GitHub. tag:build_template
System information
Describe the problem I didn't reach to convert my hdf5 model to onnx format with tf2onnx.convert. But, i tested the second method Provide the exact sequence of commands / steps that you executed before running into the problem tf2onnx error with the command: python -m tf2onnx.convert --saved-model saved_model --inputs input_1:0 --outputs gaze_output:0 --output mobilenet.onnx To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags. 2021-11-08 17:01:09,696 - WARNING - '--tag' not specified for saved_model. Using --tag serve Traceback (most recent call last): File "D:\MyPrograms\anaconda3\envs\GazeEnv\lib\runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "D:\MyPrograms\anaconda3\envs\GazeEnv\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "D:\MyPrograms\anaconda3\envs\GazeEnv\lib\site-packages\tf2onnx\convert.py", line 617, in
main()
File "D:\MyPrograms\anaconda3\envs\GazeEnv\lib\site-packages\tf2onnx\convert.py", line 228, in main
use_graph_names=args.use_graph_names)
File "D:\MyPrograms\anaconda3\envs\GazeEnv\lib\site-packages\tf2onnx\tf_loader.py", line 612, in from_saved_model
tag, signatures, concrete_function, large_model, use_graph_names)
File "D:\MyPrograms\anaconda3\envs\GazeEnv\lib\site-packages\tf2onnx\tf_loader.py", line 549, in _from_saved_model_v2
imported = tf.saved_model.load(model_path, tags=tag) # pylint: disable=no-value-for-parameter
File "D:\MyPrograms\anaconda3\envs\GazeEnv\lib\site-packages\tensorflow\python\saved_model\load.py", line 864, in load
result = load_internal(export_dir, tags, options)["root"]
File "D:\MyPrograms\anaconda3\envs\GazeEnv\lib\site-packages\tensorflow\python\saved_model\load.py", line 903, in load_internal
ckpt_options, options, filters)
File "D:\MyPrograms\anaconda3\envs\GazeEnv\lib\site-packages\tensorflow\python\saved_model\load.py", line 162, in init
self._load_all()
File "D:\MyPrograms\anaconda3\envs\GazeEnv\lib\site-packages\tensorflow\python\saved_model\load.py", line 259, in _load_all
self._load_nodes()
File "D:\MyPrograms\anaconda3\envs\GazeEnv\lib\site-packages\tensorflow\python\saved_model\load.py", line 448, in _load_nodes
slot_variable = optimizer_object.add_slot(
AttributeError: '_UserObject' object has no attribute 'add_slot'
SECOND method: loaded_model = tensorflow.keras.models.load_model('my_eye_tracking_model.h5') onnx_model = tf2onnx.convert.from_keras(loaded_model) WARNING:tensorflow:From D:\MyPrograms\anaconda3\envs\GazeEnv\lib\site-packages\tf2onnx\tf_loader.py:703: extract_sub_graph (from tensorflow.python.framework.graph_util_impl) is deprecated and will be removed in a future version. Instructions for updating: Use
tf.compat.v1.graph_util.extract_sub_graph
But the onnx_model has the architecture with input and output
import onnx onnx.save_model(onnx_model, "test.onnx")
Any other info / logs Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached.