onnx-opcounter icon indicating copy to clipboard operation
onnx-opcounter copied to clipboard

onnxruntime.capi.onnxruntime_pybind11_state.Fail: [ONNXRuntimeError] : 1 : FAIL : Load model from +all-intermediate.onnx failed:/onnxruntime_src/onnxruntime/core/graph/graph.cc:1170 void

Open ALLinLLM opened this issue 3 years ago • 6 comments

(py36) $ onnx_opcounter --calculate-macs dd3d_b1_cv22.onnx Number of parameters in the model: 6985714 Conv_0 -> Conv_0 index 5 Relu_2 -> Relu_2 index 6 MaxPool_3 -> MaxPool_3 index 7 Conv_4 -> Conv_4 index 8 Relu_6 -> Relu_6 index 9 Conv_7 -> Conv_7 index 10 Conv_9 -> Conv_9 index 11 Add_11 -> Add_11 index 12 Relu_12 -> Relu_12 index 13 Conv_13 -> Conv_13 index 14 Relu_15 -> Relu_15 index 15 Conv_16 -> Conv_16 index 16 Conv_18 -> Conv_18 index 17 Add_20 -> Add_20 index 18 Relu_21 -> Relu_21 index 19 Conv_22 -> Conv_22 index 20 Relu_24 -> Relu_24 index 21 Conv_25 -> Conv_25 index 22 Conv_27 -> Conv_27 index 23 Add_29 -> Add_29 index 24 Relu_30 -> Relu_30 index 25 Conv_31 -> Conv_31 index 26 Relu_33 -> Relu_33 index 27 Conv_34 -> Conv_34 index 28 Conv_36 -> Conv_36 index 29 Add_38 -> Add_38 index 30 Relu_39 -> Relu_39 index 31 Conv_40 -> Conv_40 index 32 Relu_42 -> Relu_42 index 33 Conv_43 -> Conv_43 index 34 Conv_45 -> Conv_45 index 35 Add_47 -> Add_47 index 36 Relu_48 -> Relu_48 index 37 Conv_49 -> Conv_49 index 38 Relu_51 -> Relu_51 index 39 Conv_52 -> Conv_52 index 40 Conv_54 -> Conv_54 index 41 Add_56 -> Add_56 index 42 Relu_57 -> Relu_57 index 43 Conv_58 -> Conv_58 index 44 Relu_60 -> Relu_60 index 45 Conv_61 -> Conv_61 index 46 Conv_63 -> Conv_63 index 47 Add_65 -> Add_65 index 48 Relu_66 -> Relu_66 index 49 Conv_67 -> Conv_67 index 50 Relu_69 -> Relu_69 index 51 Conv_70 -> Conv_70 index 52 Conv_72 -> Conv_72 index 53 Add_74 -> Add_74 index 54 Relu_75 -> Relu_75 index 55 Conv_76 -> Conv_76 index 56 Conv_77 -> Conv_77 index 57 Conv_78 -> Conv_78 index 58 Resize_97 -> Resize_97 index 59 Add_98 -> Add_98 index 60 Resize_117 -> Resize_117 index 61 Add_118 -> Add_118 index 62 Conv_119 -> Conv_119 index 63 Conv_120 -> Conv_120 index 64 Conv_121 -> Conv_121 index 65 Conv_122 -> Conv_122 index 66 Relu_123 -> Relu_123 index 67 Conv_124 -> Conv_124 index 68 Conv_125 -> Conv_125 index 69 Relu_127 -> Relu_127 index 70 Conv_128 -> Conv_128 index 71 Relu_130 -> Relu_130 index 72 Conv_131 -> Conv_131 index 73 Relu_133 -> Relu_133 index 74 Conv_134 -> Conv_134 index 75 Relu_136 -> Relu_136 index 76 Conv_137 -> Conv_137 index 77 Relu_139 -> Relu_139 index 78 Conv_140 -> Conv_140 index 79 Relu_142 -> Relu_142 index 80 Conv_143 -> Conv_143 index 81 Relu_145 -> Relu_145 index 82 Conv_146 -> Conv_146 index 83 Relu_148 -> Relu_148 index 84 Conv_149 -> Conv_149 index 85 Relu_151 -> Relu_151 index 86 Conv_152 -> Conv_152 index 87 Relu_154 -> Relu_154 index 88 Conv_155 -> Conv_155 index 89 Conv_156 -> Conv_156 index 90 Conv_157 -> Conv_157 index 91 Conv_158 -> Conv_158 index 92 Conv_159 -> Conv_159 index 93 Conv_160 -> Conv_160 index 94 Conv_161 -> Conv_161 index 95 Conv_162 -> Conv_162 index 96 Conv_163 -> Conv_163 index 97 Conv_164 -> Conv_164 index 98 Concat_165 -> cat_blob_s8l1 index 0 Concat_166 -> cat_blob_s16l2 index 1 Concat_167 -> cat_blob_s32l3 index 2 Concat_168 -> cat_blob_s64l4 index 3 Concat_169 -> cat_blob_s128l5 index 4 Traceback (most recent call last): File "/home/caishuxiao/miniconda3/envs/py36/bin/onnx_opcounter", line 8, in sys.exit(main()) File "/home/caishuxiao/miniconda3/envs/py36/lib/python3.6/site-packages/onnx_opcounter/cli.py", line 17, in main print('Number of MACs in the model: {}'.format(calculate_macs(model))) File "/home/caishuxiao/miniconda3/envs/py36/lib/python3.6/site-packages/onnx_opcounter/onnx_opcounter.py", line 90, in calculate_macs sess = rt.InferenceSession('+all-intermediate.onnx') File "/home/caishuxiao/miniconda3/envs/py36/lib/python3.6/site-packages/onnxruntime/capi/onnxruntime_inference_collection.py", line 280, in init self._create_inference_session(providers, provider_options) File "/home/caishuxiao/miniconda3/envs/py36/lib/python3.6/site-packages/onnxruntime/capi/onnxruntime_inference_collection.py", line 307, in _create_inference_session sess = C.InferenceSession(session_options, self._model_path, True, self._read_config_from_model) onnxruntime.capi.onnxruntime_pybind11_state.Fail: [ONNXRuntimeError] : 1 : FAIL : Load model from +all-intermediate.onnx failed:/onnxruntime_src/onnxruntime/core/graph/graph.cc:1170 void onnxruntime::Graph::InitializeStateFromModelFileGraphProto() This is an invalid model. Graph output (Conv_0) does not exist in the graph.

ALLinLLM avatar Jun 01 '21 13:06 ALLinLLM

I had a VGG16 model and converted it to ONNX by torch.onnx.export(). I got the same error while trying to calculate macs by the following command: onnx_opcounter --calculate-macs model_trained.onnx

shcchen avatar Jun 11 '21 02:06 shcchen

Got the same error. I have set 'opset_version=11' when transform the pytorch model to onnx model, but not work.

lr87 avatar Aug 31 '21 08:08 lr87

https://github.com/blacklong28/onnx-opcounter/commit/9e500983f0fd44861b6d7d2b2472e2a74a1c0e8c can fix the output name error.

gdh1995 avatar Feb 21 '22 03:02 gdh1995

Got the same error. I have set 'opset_version=11' when transform the pytorch model to onnx model, but not work.

Same error, have you solved the problem? Thanks.

JuntaoLiu01 avatar Jun 28 '22 09:06 JuntaoLiu01

Hi, I am facing the same issue with a pretty simple model. Any ideas and solutions?

brgrp avatar Feb 06 '23 13:02 brgrp

+1 cant use it for any model of mine :( @gmalivenko any idea how to fix this? Thanks!

bsridatta avatar Jul 03 '23 09:07 bsridatta