Pytorch 0.3 ONNX export for IMDB model

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(m3.data.val_dl))[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.

I’ve never tried onnx, sorry!

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.

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: https://github.com/pytorch/pytorch/commit/410fd58b4f5dae5904fd0dbe05149f743bfb1c11

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