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.protobuf.pyext._message.RepeatedScalarContaine' #23

Closed
emanuelcovaci opened this issue Oct 15, 2019 · 6 comments

Comments

@emanuelcovaci
Copy link

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

You can see the ONNX Model here: https://ibb.co/sKnbxWY

import onnx2keras
from onnx2keras import onnx_to_keras
import keras
import onnx

onnx_model = onnx.load('onnxModel.onnx')
k_model = onnx_to_keras(onnx_model, ['input_1'])

keras.models.save_model(k_model,'kerasModel.h5',overwrite=True,include_optimizer=True)
File "C:/../onnx2Keras.py", line 7, in <module>
    k_model = onnx_to_keras(onnx_model, ['input_1'])
  File "..\site-packages\onnx2keras\converter.py", line 80, in onnx_to_keras
    weights[onnx_extracted_weights_name] = numpy_helper.to_array(onnx_w)
TypeError: unhashable type: 'google.protobuf.pyext._message.RepeatedScalarContainer'
@gmalivenko
Copy link
Owner

Hello @emanuelcovaci.
Can you share your ONNX model so I can reproduce the error?
In your error message I see the issue related to onnx weights loading, not to the model architecture, because actual conversion hasn't even started.

@emanuelcovaci
Copy link
Author

Hello @nerox8664

Here you can find the model https://drive.google.com/open?id=1oQTzQ0BO6msO_djhbgsdvpaM22PLtn49

@gmalivenko
Copy link
Owner

Please, try to convert your model with updated version of the library.
pip install --upgrade onnx2keras

Also, use name_policy='renumerate' parameter to fix naming error.

@emanuelcovaci
Copy link
Author

It's working fine now. Thank you

@ghost
Copy link

ghost commented Jun 3, 2020

I still have this error.

here is my onnx file if it can help:
https://drive.google.com/file/d/17VOpLc3zWqjX8mqFWH2BRYYIY0v4dW5A/view?usp=sharing

@mdhimes
Copy link

mdhimes commented Jul 28, 2020

I'm on the latest version via pip (0.0.22), and I am also getting this same error. Latest version of onnx (1.7.0) as well.

Pull request related to this issue: #76

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