Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to convert model to onnx #38

Open
blueprintparadise opened this issue Aug 23, 2022 · 3 comments
Open

Unable to convert model to onnx #38

blueprintparadise opened this issue Aug 23, 2022 · 3 comments

Comments

@blueprintparadise
Copy link

Hi, I have been meaning to convert the final o/p of docformer in the document classification notebook from .ckpt to onnx but am unable to do so. I have tried the standard torch.onnx.export method but the issue lies in the "dummy_variable" input in the code. Can you please point me in the right direction.

model = DocFormer.load_from_checkpoint(CKPT_PATH)
model.eval() 

    # Let's create a dummy input tensor  


    # Export the model   
torch.onnx.export(model,         # model being run 
     #for_conversion,  
     maintup,
      #(input_ids,resized_scaled_img, x_features, y_features),         # model input (or a tuple for multiple inputs) 
     "ImageClassifier.onnx",       # where to save the model  
     export_params=True,  # store the trained parameter weights inside the model file 
     opset_version=10,    # the ONNX version to export the model to 
     do_constant_folding=True,  # whether to execute constant folding for optimization 
     input_names = ['resized_scaled_img', 'x_features', 'y_features', 'input_ids', 'resized_and_aligned_bounding_boxes', 'label'],   # the model's input names 
 # the model's output names 
                 ) 
print(" ") 
print('Model has been converted to ONNX') 
@uakarsh
Copy link
Collaborator

uakarsh commented Aug 24, 2022

Hi there,

I have not explored much of ONNX, but I would explore it in a few days and would get back to you as soon as possible.

Regards,
Akarsh

@blueprintparadise
Copy link
Author

Hi @uakarsh any updates on the conversion.
I have a few changes to the conversion code and managed the conversion. But this is the inference error.

NotImplemented: [ONNXRuntimeError] : 9 : NOT_IMPLEMENTED : Could not find an implementation for the node Clip_5:Clip(12)

Can you give me some input on how to tackle it.

@uakarsh
Copy link
Collaborator

uakarsh commented Sep 15, 2022

Hi, I did the experiment with MLM here

Can you go through this, and let me know if this helps? Apologies for late reply

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants