Error when trying to load .onnx files

Hello

I have just installed TVM and was going through the tutorials.

I ran tvmc compile --target "llvm" --output resnet50-v2-7-tvm.tar resnet50-v2-7.onnx, but it crashed with the following: RuntimeWarning: Unexpected end-group tag: Not all data was converted decoded = cast(Optional[int], proto.ParseFromString(s)) Traceback (most recent call last): File “/usr/lib/python3.6/runpy.py”, line 193, in _run_module_as_main “main”, mod_spec) File “/usr/lib/python3.6/runpy.py”, line 85, in _run_code exec(code, run_globals) File “/home/dtpopovici/Documents/Repos/tvm/python/tvm/driver/tvmc/main.py”, line 24, in tvmc.main.main() File “/home/dtpopovici/Documents/Repos/tvm/python/tvm/driver/tvmc/main.py”, line 105, in main sys.exit(_main(sys.argv[1:])) File “/home/dtpopovici/Documents/Repos/tvm/python/tvm/driver/tvmc/main.py”, line 93, in _main return args.func(args) File “/home/dtpopovici/Documents/Repos/tvm/python/tvm/driver/tvmc/compiler.py”, line 155, in drive_compile tvmc_model = frontends.load_model(args.FILE, args.model_format, args.input_shapes) File “/home/dtpopovici/Documents/Repos/tvm/python/tvm/driver/tvmc/frontends.py”, line 396, in load_model mod, params = frontend.load(path, shape_dict, **kwargs) File “/home/dtpopovici/Documents/Repos/tvm/python/tvm/driver/tvmc/frontends.py”, line 164, in load model = onnx.load(path) File “/home/dtpopovici/.local/lib/python3.6/site-packages/onnx/init.py”, line 121, in load_model model = load_model_from_string(s, format=format) File “/home/dtpopovici/.local/lib/python3.6/site-packages/onnx/init.py”, line 158, in load_model_from_string return _deserialize(s, ModelProto()) File “/home/dtpopovici/.local/lib/python3.6/site-packages/onnx/init.py”, line 103, in _deserialize decoded, len(s))) google.protobuf.message.DecodeError: Protobuf decoding consumed too few bytes: 84 out of 173225

I installed TVM and its dependencies on an Ubuntu 20.04 system.

Does the above problem raise any bells? Highly appreciate an answer.

Best, Doru

@dpopovici If you’re following the tvmc tutorial, the problem is that the model file link is wrong and you are probably using a model file which is broken. Here is the correct link:

https://github.com/onnx/models/raw/main/vision/classification/resnet/model/resnet50-v2-7.onnx

Please remove the file on your local machine and download it again. Let me know if that helps.

When I try to compile with TVMC using that link, I now get this error: Check failed: (pval != nullptr) is false: Cannot allocate memory symbolic tensor shape [?, 3, 224, 224]. What to do? I’m running this command:

tvmc compile
–target “llvm”
–output resnet50-v2-7-tvm.tar
resnet50-v2-7.onnx

I am following this tutorial: Compiling and Optimizing a Model with TVMC — tvm 0.8.dev0 documentation (apache.org)

Hello, I have encountered the same problem. Have you solved this problem? Can you share the solution

@mehrdadh Yes, it works. I met the same problem then I solve it following your tips. :tada:

1 Like

What is the reason why the program does not respond after running to: tuner_obj = XGBTuner(task, loss_type=“rank”)? Is it because windows is not compatible? How can I solve it?Thanks.

Hey, I got the same error. Do you find any solution? if you have could you please share with me.

Hello, I have encountered the same problem. Have you solved this problem? Can you share the solution with me