I want to get the Intermediate representation files and/or the standalone bundles (.o files for my CPU) from ONNX models. I do not find documentation for the same. Please let me know if it is already present or guide me through how I can convert ONNX to IR.
After simple --help command on the image-classifier binary file I got to know that I have to provide the model.onnx file to -m argument. Ex:
$ ../bin/image-classifier ../../tests/images/imagenet/dog_207.png -image_mode=0to1 -m ./model.onnx -model_input_name=gpu_0/data -cpu -emit-bundle build -g -dump-ir
The model.onnx is that of ResNet-50 downloaded from official site (I downloaded master).
Now I am facing another issue: After running the above command I get:
image-classifier: ../lib/Importer/ProtobufLoader.cpp:33: glow::Tensor* glow::ProtobufLoader::getTensorByName(llvm::StringRef): Assertion `tensors_.count(name) && "There is no tensor registered with this name."' failed.
Aborted (core dumped)
I checked my protoc version:
$ protoc --version
This gives me:
libprotoc 2.6.1
@nadavrot Can you help?
Hi @csbenk, the issue here is that your -model_input_name is set incorrectly. You should instead use -model_input_name=gpu_0/data_0. You can look here to see how we are loading this proto along with other image classifiers. Note that this name is proto/model dependent, so the best way to determine this right now if you don't know it is probably to decode the proto and inspect it.
Once you fix that you should be able to dump-ir, dumpGraphDAG, etc. I'm going to close this but feel free to reopen or comment further if you have issues.
Thanks for the help @jfix71 . Got it running.
Thank you @jfix71 @csbenk
Most helpful comment
Thanks for the help @jfix71 . Got it running.