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

Key error for Reshape when trying to convert ONNX model #103

Closed
samedii opened this issue Sep 14, 2022 · 5 comments · Fixed by #104
Closed

Key error for Reshape when trying to convert ONNX model #103

samedii opened this issue Sep 14, 2022 · 5 comments · Fixed by #104
Assignees
Labels
bug Something isn't working

Comments

@samedii
Copy link

samedii commented Sep 14, 2022

Do you think this error occuring because the weights name is missing in the ONNX file or because the operation isn't found?

I'm getting the right results if I load and run the model with ONNX runtime at least.

  File "/home/richard/miniconda3/envs/3.9.13/lib/python3.9/site-packages/onnx2torch/converter.py", line 109, in convert
    torch_module, onnx_mapping = converter(onnx_node, onnx_graph)
  File "/home/richard/miniconda3/envs/3.9.13/lib/python3.9/site-packages/onnx2torch/node_converters/gemm.py", line 65, in _
    weights = graph.initializers[weights_value_name]
KeyError: 'Reshape__2177:0'

Here is a link to the ONNX file if you want to try it yourself
https://drive.google.com/file/d/1P_Bl7n2hbUoOhfMh_9UJfgK_N8kP_xjB/view?usp=sharing

I'm trying to make this model https://paperswithcode.com/paper/lit-zero-shot-transfer-with-locked-image-text easier to use for people

@senysenyseny16
Copy link
Collaborator

senysenyseny16 commented Sep 15, 2022

Hi, Richard!

Do you think this error occuring because the weights name is missing in the ONNX file or because the operation isn't found?

The problem is that our implementation is based on the assumption that B (Y = alpha * A' * B' + beta * C) is in initializers, while your LiB-B16B network has GEMM operation where B is tensor, not initializer.

We'll fix it soon.

@senysenyseny16 senysenyseny16 added the bug Something isn't working label Sep 15, 2022
@samedii
Copy link
Author

samedii commented Sep 15, 2022

Okay I tried to debug the code and I think I maybe understand the issue. This might be due to how JAX works (parameters are sent to functional versions of everything)

Do you have a pattern for solving this type of issue already? I can have a go if you can point me in the right direction

@senysenyseny16
Copy link
Collaborator

senysenyseny16 commented Sep 15, 2022

Your model corresponds to ONNX specification, the problem is on our side.

Do you have a pattern for solving this type of issue already? I can have a go if you can point me in the right direction

Bug has already been fixed, the fix will be published tomorrow.

@senysenyseny16
Copy link
Collaborator

Richard,

fix has been published on PyPI and conda-forge.

Thanks for finding this error, feel free to open new issues.

@samedii
Copy link
Author

samedii commented Sep 16, 2022

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants