Loading a prebuilt caffe model in pytorch 1.0

I heard that there is some good integration of caffe and pytorch with the 1.0 release. I am trying to use the modified GoogleLeNet model that has been trained on the Compcars dataset. The pretrained caffe model and the weights are available here: https://gist.github.com/bogger/b90eb88e31cd745525ae

So, basically what is available is the prototxt model definition file and the caffemodel weights file. So, I was looking into the documentation for pytorch 1.0 and came across the following tutorial: https://pytorch.org/tutorials/advanced/super_resolution_with_caffe2.html

I also saw some converters online for converting the caffemodel file to PTH. I was wondering if there is something built into pytorch 1.0 to sort of somehow take the caffe model definition and weight files and generate the model from this?

1 Like


You can always use ONNX to do caffe2 -> onnx -> pytorch. But people usually do the opposite :smiley: and there is no special integration to run caffe2 models in pytorch.


Thanks for that. Unfortunately, this model seems to be using an older version of caffe. I will investigate on what I can do. My issue is that I need to do some transfer learning on this model and would like to change it later as well. So hoping to find a convenient way to do this.