我正在尝试将我的tensorflow(2.6.0)/keras训练模型转换为onnx,使用tf2onnx。我已使用model.save(dirPath)保存了模型,在此目录中我有:
但是,当我在命令中执行时:
python -m tf2onnx.convert --saved-model C:\Users\guill\Desktop\CSIC\modelSaved --output model.onnx
我收到这个错误:
C:\Users\guill>python -m tf2onnx.convert --saved-model C:\Users\guill\Desktop\CSIC\modelSaved --output model.onnx
C:\Python\Python39\lib\runpy.py:127: RuntimeWarning: 'tf2onnx.convert' found in sys.modules after import of package 'tf2onnx', but prior to execution of 'tf2onnx.convert'; this may result in unpredictable behaviour
warn(RuntimeWarning(msg))
2021-09-30 22:24:57,114 - WARNING - '--tag' not specified for saved_model. Using --tag serve
Traceback (most recent call last):
File "C:\Python\Python39\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Python\Python39\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Python\Python39\lib\site-packages\tf2onnx\convert.py", line 617, in <module>
main()
File "C:\Python\Python39\lib\site-packages\tf2onnx\convert.py", line 225, in main
graph_def, inputs, outputs, initialized_tables, tensors_to_rename = tf_loader.from_saved_model(
File "C:\Python\Python39\lib\site-packages\tf2onnx\tf_loader.py", line 611, in from_saved_model
_from_saved_model_v2(model_path, input_names, output_names,
File "C:\Python\Python39\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 "C:\Python\Python39\lib\site-packages\tensorflow\python\saved_model\load.py", line 864, in load
result = load_internal(export_dir, tags, options)["root"]
File "C:\Python\Python39\lib\site-packages\tensorflow\python\saved_model\load.py", line 902, in load_internal
loader = loader_cls(object_graph_proto, saved_model_proto, export_dir,
File "C:\Python\Python39\lib\site-packages\tensorflow\python\saved_model\load.py", line 162, in __init__
self._load_all()
File "C:\Python\Python39\lib\site-packages\tensorflow\python\saved_model\load.py", line 259, in _load_all
self._load_nodes()
File "C:\Python\Python39\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'
目前没有回答
相关问题 更多 >
编程相关推荐