Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
kurpav00 opened this issue Jun 24, 2023 · 3 comments
Open

Comments

@kurpav00
Copy link

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

@alfredoescalante95
Copy link

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

@kurpav00
Copy link
Author

kurpav00 commented Sep 7, 2023

@alfredoescalante95 Unfortunately no; the repository seems abandoned.

@pythonmonty
Copy link

I'm also getting the exact same error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants