-
Notifications
You must be signed in to change notification settings - Fork 455
Closed
Description
Dear All,
I would like to report the issue when converting tensorflow saved model to onnx model
Environment:
$pip3 list
Package Version
----------------------------- -------------------
tb-nightly 2.4.0a20201026
tensorboard 2.3.0
tensorboard-plugin-wit 1.7.0
tensorflow 2.3.1
tensorflow-addons 0.11.2
tensorflow-datasets 4.0.1
tensorflow-estimator 2.3.0
tensorflow-hub 0.9.0
tensorflow-metadata 0.24.0
tensorflow-model-optimization 0.5.0
tf2onnx 1.7.1
Procedure:
1/ download saved model imagenet/inception_v1/classification
2/ run command to convert saved model to onnx model:
python3 -m tf2onnx.convert --output model.onnx --concrete_function 0 --saved-model imagenet_inception_v1_classification_4
error log:
python3 -m tf2onnx.convert --output model.onnx --concrete_function 0 --saved-model imagenet_inception_v1_classification_4
2020-10-29 15:39:13.569001: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'libcudart.so.10.1'; dlerror: libcudart.so.10.1: cannot open shared object file: No such file or directory
2020-10-29 15:39:13.569130: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
2020-10-29 15:39:15,970 - WARNING - '--tag' not specified for saved_model. Using --tag serve
2020-10-29 15:39:16.282882: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'libcuda.so.1'; dlerror: libcuda.so.1: cannot open shared object file: No such file or directory
2020-10-29 15:39:16.283089: W tensorflow/stream_executor/cuda/cuda_driver.cc:312] failed call to cuInit: UNKNOWN ERROR (303)
2020-10-29 15:39:16.283213: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:156] kernel driver does not appear to be running on this host (hp): /proc/driver/nvidia/version does not exist
2020-10-29 15:39:16.283569: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN)to use the following CPU instructions in performance-critical operations: AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2020-10-29 15:39:16.303386: I tensorflow/core/platform/profile_utils/cpu_utils.cc:104] CPU Frequency: 2712000000 Hz
2020-10-29 15:39:16.306374: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x62bbec0 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2020-10-29 15:39:16.306519: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): Host, Default Version
2020-10-29 15:39:20,079 - INFO - Signatures found in model: [].
2020-10-29 15:39:20.404054: I tensorflow/core/grappler/devices.cc:69] Number of eligible GPUs (core count >= 8, compute capability >= 0.0): 0
2020-10-29 15:39:20.404305: I tensorflow/core/grappler/clusters/single_machine.cc:356] Starting new session
2020-10-29 15:39:20.668518: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:816] Optimization results for grappler item: graph_to_optimize
2020-10-29 15:39:20.668666: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:818] function_optimizer: Graph size after: 2054 nodes (1820), 3308 edges (3074), time = 109.225ms.
2020-10-29 15:39:20.668718: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:818] function_optimizer: function_optimizer did nothing. time = 1.878ms.
Traceback (most recent call last):
File "/home/hoaphan/.local/lib/python3.6/site-packages/tensorflow/python/framework/importer.py", line 497, in _import_graph_def_internal
graph._c_graph, serialized, options) # pylint: disable=protected-access
tensorflow.python.framework.errors_impl.InvalidArgumentError: Input 0 of node StatefulPartitionedCall/StatefulPartitionedCall/train/InceptionV1/InceptionV1/Conv2d_1a_7x7/BatchNorm/AssignMovingAvg/AssignSubVariableOp was passed float from Func/StatefulPartitionedCall/StatefulPartitionedCall/input/_239:0 incompatible with expected resource.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/hoaphan/.local/lib/python3.6/site-packages/tf2onnx/convert.py", line 185, in <module>
main()
File "/home/hoaphan/.local/lib/python3.6/site-packages/tf2onnx/convert.py", line 136, in main
args.signature_def, args.concrete_function, args.large_model)
File "/home/hoaphan/.local/lib/python3.6/site-packages/tf2onnx/tf_loader.py", line 330, in from_saved_model
_from_saved_model_v2(model_path, input_names, output_names, tag, signatures, concrete_function, large_model)
File "/home/hoaphan/.local/lib/python3.6/site-packages/tf2onnx/tf_loader.py", line 317, in _from_saved_model_v2
raise e
File "/home/hoaphan/.local/lib/python3.6/site-packages/tf2onnx/tf_loader.py", line 313, in _from_saved_model_v2
frozen_graph = from_function(concrete_func, inputs, outputs, large_model)
File "/home/hoaphan/.local/lib/python3.6/site-packages/tf2onnx/tf_loader.py", line 124, in from_function
frozen_func = convert_variables_to_constants_v2(func, lower_control_flow=False)
File "/home/hoaphan/.local/lib/python3.6/site-packages/tensorflow/python/framework/convert_to_constants.py", line 1075, in convert_variables_to_constants_v2
converted_input_indices)
File "/home/hoaphan/.local/lib/python3.6/site-packages/tensorflow/python/framework/convert_to_constants.py", line 1001, in _construct_concrete_function
new_output_names)
File "/home/hoaphan/.local/lib/python3.6/site-packages/tensorflow/python/eager/wrap_function.py", line 650, in function_from_graph_def
wrapped_import = wrap_function(_imports_graph_def, [])
File "/home/hoaphan/.local/lib/python3.6/site-packages/tensorflow/python/eager/wrap_function.py", line 628, in wrap_function
collections={}),
File "/home/hoaphan/.local/lib/python3.6/site-packages/tensorflow/python/framework/func_graph.py", line 986, in func_graph_from_py_func
func_outputs = python_func(*func_args, **func_kwargs)
File "/home/hoaphan/.local/lib/python3.6/site-packages/tensorflow/python/eager/wrap_function.py", line 87, in __call__
return self.call_with_variable_creator_scope(self._fn)(*args, **kwargs)
File "/home/hoaphan/.local/lib/python3.6/site-packages/tensorflow/python/eager/wrap_function.py", line 93, in wrapped
return fn(*args, **kwargs)
File "/home/hoaphan/.local/lib/python3.6/site-packages/tensorflow/python/eager/wrap_function.py", line 648, in _imports_graph_def
importer.import_graph_def(graph_def, name="")
File "/home/hoaphan/.local/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 507, in new_func
return func(*args, **kwargs)
File "/home/hoaphan/.local/lib/python3.6/site-packages/tensorflow/python/framework/importer.py", line 405, in import_graph_def
producer_op_list=producer_op_list)
File "/home/hoaphan/.local/lib/python3.6/site-packages/tensorflow/python/framework/importer.py", line 501, in _import_graph_def_internal
raise ValueError(str(e))
ValueError: Input 0 of node StatefulPartitionedCall/StatefulPartitionedCall/train/InceptionV1/InceptionV1/Conv2d_1a_7x7/BatchNorm/AssignMovingAvg/AssignSubVariableOp was passed float from Func/StatefulPartitionedCall/StatefulPartitionedCall/input/_239:0 incompatible with expected resource.
could anyone please help me to check this issue,
Thanks.
Metadata
Metadata
Assignees
Labels
No labels