Not able to export large model with onnx

I am trying to export a model(which when dumped on disk as a pt file, is 4GB). The code I use is:

torch.onnx.export(net,               # model being run
                  (doc_embeddings, shortlist),                         # model input (or a tuple for multiple inputs)
                  "/path/to/a/folder/net.onnx",   # where to save the model (can be a file or file-like object)
                  opset_version=11,          # the ONNX version to export the model to
                  input_names = ['doc_embeddings', 'shortlist'],   # the model's input names
                  output_names = ['scores'], # the model's output names
                  dynamic_axes={'doc_embeddings' : {0 : 'batch_size'},    # variable length axes
                                'shortlist' : {0 : 'batch_size', 1: 'num_shortlist'},
                                'scores' : {0 : 'batch_size', 1: 'num_shortlist'}},

But this doesn’t work and I get the error: RuntimeError: Exporting model exceed maximum protobuf size of 2GB. Please call torch.onnx.export with use_external_data_format=True. I would ideally expect that the model would be exported with external files after specifying use_external_data_format=True

+1 I’m having the same problem over here