Error when trying to load .onnx files


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/”, line 193, in _run_module_as_main “main”, mod_spec) File “/usr/lib/python3.6/”, line 85, in _run_code exec(code, run_globals) File “/home/dtpopovici/Documents/Repos/tvm/python/tvm/driver/tvmc/”, line 24, in tvmc.main.main() File “/home/dtpopovici/Documents/Repos/tvm/python/tvm/driver/tvmc/”, line 105, in main sys.exit(_main(sys.argv[1:])) File “/home/dtpopovici/Documents/Repos/tvm/python/tvm/driver/tvmc/”, line 93, in _main return args.func(args) File “/home/dtpopovici/Documents/Repos/tvm/python/tvm/driver/tvmc/”, 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/”, line 396, in load_model mod, params = frontend.load(path, shape_dict, **kwargs) File “/home/dtpopovici/Documents/Repos/tvm/python/tvm/driver/tvmc/”, line 164, in load model = onnx.load(path) File “/home/dtpopovici/.local/lib/python3.6/site-packages/onnx/”, line 121, in load_model model = load_model_from_string(s, format=format) File “/home/dtpopovici/.local/lib/python3.6/site-packages/onnx/”, line 158, in load_model_from_string return _deserialize(s, ModelProto()) File “/home/dtpopovici/.local/lib/python3.6/site-packages/onnx/”, 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:

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

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