Pytorch 0.3 ONNX export for IMDB model

(Julian Bright) #1

Given we are now using pytorch 0.3 which includes ONNX support, I’m wondering if it would be possible to create a ONNX export for the IMDB sentiment classification model.

I naively attempt to fetch some input data and export the m3.model which is used for prediction:

dummy_input = next(iter([0]
torch.onnx.export(m3.model, dummy_input, f'{PATH}/models/imdb.proto', verbose=True)

i’m getting error:

getTracingState: Assertion `var_state == state` failed.

@jeremy I understand that the exporter requires specific input as it uses the tracer to produce the model, can I give it a single example, and if so i’m i doing it wrong or is it not possible?

Thanks in advance.

(Jeremy Howard) #2

I’ve never tried onnx, sorry!

(Davide Boschetto) #3

Can’t help you for now, but I’m very interested to see how this ONNX will spread. Chollet kinda killed my inquiry with IMHO baseless motivations, but… who knows.

(Kam) #4

Trying to do a onnx export for a similar model and getting the same issue "getTracingState: Assertion `var_state == state` failed. were you able to make any progress? Originally I thought it was an issue of torch export not supporting RNN but 2 days ago they merged:

(Julian Bright) #5

I haven’t tried again, be interested to know if you get this working.