2

I have a model in onnx format, and I want to run it in fastai learner. possibly something like this

learn = learn.load('model.onnx')

another way is to convert back to pth format, but I dont see any proper library on this task. I need your help in either one of this approach. Thanks.

1 Answers1

1

There is no native solution and some people are currently working on it : https://github.com/ENOT-AutoDL/onnx2torch

Also to be clear, a .pth checkpoint , usually only contains the parameters such as weights, biases... not the operations like conv2d, batchnorm2d, pooling. An onnx model, in another hand, contains both operations and parameters that's why you can infer them. If, from an onnx, you only need the weights & biases in order to load a state into a torch model already implemented, it might be quite easy, if you want to automatically build a torch model from an onnx, that's the hard part.

Maxime D.
  • 306
  • 5
  • 17