How do I run the inference in model I have written in pytorch on glow?


I exported a mobilenetv2 model form pytorch that I have trained to do binary classification in the onnx format. I understand the the image classifier example is used to load the model and the image and test it.
But are there any other steps or sample code you have with better documentation that will help me understand to utilize the model better?

I understand you have the model-compiler tool to compile the model to an executable. Also is there a way to deploy this model on GPU? What steps do I need to follow for that?

Hi, are you interested in ahead-of-time compilation (called creating a “bundle” in Glow terminology), or in JIT compilation? You can use image-classifier for both purposes, or model-compiler for ahead of time.

There are some examples for AOT here and JIT here.

For GPUs, the best we have right now is our OpenCL backend. Otherwise there’s not much open source GPU support currently, as we have focused Glow more on supporting specialized accelerator HW for inference such as Intel’s NNPI, Habana’s Goya, etc.

Hi @jfix ,

I was able to execute the image classifier tool. Its seems that there seems to be a lot more information for AOT. Although a basic command line example with the parameters that the image-classifier to might make the process easier. Thanks!

I’d suggest taking a look at the Resnet50 bundle example – it simply has a main.cpp and CMake that drives all of the commands you need to create an AOT bundle and run it.