Open
Description
Describe the bug
When converting a tflite model to onnx format, I get the following error:
$ python -m tf2onnx.convert --opset 200 --tflite okay_nabu.tflite --output okay_nabu.onnx
<frozen runpy>:128: 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
2025-01-12 01:55:41,581 - WARNING - ***IMPORTANT*** Installed protobuf is not cpp accelerated. Conversion will be extremely slow. See https://github.com/onnx/tensorflow-onnx/issues/1557
2025-01-12 01:55:41,582 - INFO - Using tensorflow=2.18.0, onnx=1.17.0, tf2onnx=1.16.1/e1042c
2025-01-12 01:55:41,582 - INFO - Using opset <onnx, 200>
2025-01-12 01:55:41,582 - WARNING - Currently installed onnx package 1.17.0 is too low to support opset 200, please upgrade onnx package to avoid potential conversion issue.
INFO: Created TensorFlow Lite XNNPACK delegate for CPU.
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "./venv/lib/python3.12/site-packages/tf2onnx/convert.py", line 714, in <module>
main()
File "./venv/lib/python3.12/site-packages/tf2onnx/convert.py", line 273, in main
model_proto, _ = _convert_common(
^^^^^^^^^^^^^^^^
File "./venv/lib/python3.12/site-packages/tf2onnx/convert.py", line 168, in _convert_common
g = process_tf_graph(tf_graph, const_node_values=const_node_values,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "./venv/lib/python3.12/site-packages/tf2onnx/tfonnx.py", line 453, in process_tf_graph
main_g, subgraphs = graphs_from_tflite(tflite_path, input_names, output_names)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "./venv/lib/python3.12/site-packages/tf2onnx/tflite_utils.py", line 153, in graphs_from_tflite
parse_tflite_graph(tfl_graph, opcodes, model, prefix, tensor_shapes_from_interpreter)
File "./venv/lib/python3.12/site-packages/tf2onnx/tflite_utils.py", line 485, in parse_tflite_graph
onnx_node = utils.make_onnx_node_with_attr(optype, input_names, output_names, name=output_names[0], **attr)
~~~~~~~~~~~~^^^
IndexError: list index out of range
System information
- OS Platform and Distribution (e.g., Linux Ubuntu 18.04*): macOS arm64
- TensorFlow Version: 2.18
- Python version: 3.12.8
- ONNX version (if applicable, e.g. 1.11*):
- ONNXRuntime version (if applicable, e.g. 1.11*): 1.20.1
To Reproduce
curl -L -o okay_nabu.tflite https://github.com/esphome/micro-wake-word-models/raw/refs/heads/main/models/okay_nabu.tflite
python -m tf2onnx.convert --opset 200 --tflite okay_nabu.tflite --output okay_nabu.onnx