Problems converting InferSent model into ONNX

Hello,

I am trying to convert InferSent pre-trained model into ONNX (https://github.com/facebookresearch/InferSent)
which can be downloaded using this,
curl -Lo encoder/infersent.allnli.pickle https://s3.amazonaws.com/senteval/infersent/infersent.allnli.pickle

and loaded into PyTorch by this
model = torch.load(‘infersent.allnli.pickle’, map_location=lambda storage, loc: storage)

However, while saving it into Onnx using the below code, I get
"ValueError: NestedIOFunction doesn’t know how to process an input object of type models.BLSTMEncoder"

import torch.onnx
import torchvision
torch.onnx.export(model, _, “infersent.proto”, verbose=True)

Any help will be appreciated.

1 Like

Hello,

Did you find a way to solve this? I am in similar situation now, any advise is appreciated.

Can you try this https://github.com/facebookresearch/SentEval/issues/3#issuecomment-313414393

I don’t have a problem while loading the pre trained model, i am getting issues while converting it to onnx.