question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Key error for Reshape when trying to convert ONNX model

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5

github_iconTop GitHub Comments

2reactions
senysenyseny16commented, 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.

1reaction
senysenyseny16commented, 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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

infer shape error when trying to convert tf model to onnx ...
I have made a simple model in tensorflow it seems to throwing a lot of errors when trying to convert to onnx format....
Read more >
OpenVINO output key error after conversion from ONNX
I've converted a (modified) Darknet model to onnx, (tried opset 10 & 11) and then converting this onnx model into IR using this...
Read more >
'Resize' Error in converting from ONNX model to keras ...
I am trying to convert an ONNX model to a Keras model using onnx2keras, so that I can implement this: ...
Read more >
ONNX to TF-Lite Model Conversion
This tutorial describes how to convert an ONNX formatted model file into a format that can execute on an embedded device using Tensorflow-Lite...
Read more >
IShuffleLayer applied to shape tensor must have 0 or 1 ...
I convert the model to onnx succefully, but when I try to convert onnx to ... must have 0 or 1 reshape dimensions:...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found