Skip to content

[tflite] Error loading model into tflite interpreter: Didn't find op for builtin opcode 'CONV_2D' version '6'. #2052

@josephrocca

Description

@josephrocca

Describe the feature request

Support for CONV_2D version 6 for tflite conversion. I'm guessing that this entails updating the tflite interpreter used in this package.

Describe scenario use case

I'd like to convert the newly-open-sourced Lyra V2 to ONNX.

Minimal reproduction of error: https://colab.research.google.com/gist/josephrocca/8916bf2faa938ed24f89e0228bb20481/lyra-v2-soundstream-tflite-to-onnx-conversion-error-didn-t-find-op-for-builtin-opcode-conv_2d-version-6.ipynb

Full error:

/usr/lib/python3.7/runpy.py:125: 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))
2022-10-02 05:13:41,350 - INFO - Using tensorflow=2.8.2, onnx=1.12.0, tf2onnx=1.12.0/c60c5e
2022-10-02 05:13:41,350 - INFO - Using opset <onnx, 16>
2022-10-02 05:13:41,399 - WARNING - Error loading model into tflite interpreter: Didn't find op for builtin opcode 'CONV_2D' version '6'. An older version of this builtin might be supported. Are you using an old TFLite binary with a newer model?
Registration failed.

Traceback (most recent call last):
  File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/local/lib/python3.7/dist-packages/tf2onnx/convert.py", line 706, in <module>
    main()
  File "/usr/local/lib/python3.7/dist-packages/tf2onnx/convert.py", line 291, in main
    output_path=args.output)
  File "/usr/local/lib/python3.7/dist-packages/tf2onnx/convert.py", line 165, in _convert_common
    custom_op_handlers=custom_op_handlers, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/tf2onnx/tfonnx.py", line 453, in process_tf_graph
    main_g, subgraphs = graphs_from_tflite(tflite_path, input_names, output_names)
  File "/usr/local/lib/python3.7/dist-packages/tf2onnx/tflite_utils.py", line 153, in graphs_from_tflite
    parse_tflite_graph(tfl_graph, opcodes, model, prefix, tensor_shapes_from_interpreter)
  File "/usr/local/lib/python3.7/dist-packages/tf2onnx/tflite_utils.py", line 485, in parse_tflite_graph
    onnx_node = helper.make_node(optype, input_names, output_names, name=output_names[0], **attr)
IndexError: list index out of range

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestpending on user responseWaiting for more information or validation from user

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions