onnx2keras icon indicating copy to clipboard operation
onnx2keras copied to clipboard

TypeError: unhashable type: 'google._upb._message.RepeatedScalarContainer'

Open kurpav00 opened this issue 1 year ago • 3 comments

I am trying to convert an ONNX model to Keras, but when I call the conversion function I receive the following error message "TypeError: unhashable type: 'google._upb._message.RepeatedScalarContainer'"

import onnx
from onnx2keras import onnx_to_keras
onnx_model = onnx.load('model.onnx')
k_model = onnx_to_keras(onnx_model, ['image'])

Results in:

INFO:onnx2keras:Converter is called.
DEBUG:onnx2keras:List input shapes:
DEBUG:onnx2keras:None
DEBUG:onnx2keras:List inputs:
DEBUG:onnx2keras:Input 0 -> image.
DEBUG:onnx2keras:List outputs:
DEBUG:onnx2keras:Output 0 -> TFLITE2ONNX_Quant_scores_dequantized.
DEBUG:onnx2keras:Gathering weights to dictionary.
Traceback (most recent call last):
  File "/home/kurpav00/anaconda3/envs/tf/lib/python3.9/site-packages/onnx2keras-0.0.24-py3.9.egg/onnx2keras/converter.py", line 86, in onnx_to_keras
    weights[onnx_extracted_weights_name] = numpy_helper.to_array(onnx_w)
TypeError: unhashable type: 'google._upb._message.RepeatedScalarContainer'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/kurpav00/anaconda3/envs/tf/lib/python3.9/site-packages/onnx2keras-0.0.24-py3.9.egg/onnx2keras/converter.py", line 88, in onnx_to_keras
    onnx_extracted_weights_name = onnx_w.ListFields()[3][1]
IndexError: list index out of range

It seems to be the same error as in #23 although it is claimed to be fixed. Using "name_policy='renumerate'" also does not help.

Here is the ONNX model used: model.zip

kurpav00 avatar Jun 24 '23 06:06 kurpav00

I am getting the same error, any update on this?

alfredoescalante95 avatar Sep 07 '23 11:09 alfredoescalante95

@alfredoescalante95 Unfortunately no; the repository seems abandoned.

kurpav00 avatar Sep 07 '23 13:09 kurpav00

I'm also getting the exact same error

pythonmonty avatar Mar 08 '24 21:03 pythonmonty