-
Notifications
You must be signed in to change notification settings - Fork 25.6k
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
BART + ONNX torch.jit error iterabletree cannot be used as a value #14491
Comments
Pinging @michaelbenayoun on the issue :) |
@LysandreJik I will take a look at this. |
Thank you, @fatcat-z! |
ok, so it seems like a problem with versions. Works with torch==1.10.0 numpy==1.21.4 and latest transformers |
There is another bug(?) in run_onnx_exporter.py script. Line, where dynamic axes are declared, the attention_mask isn't included in the set. Any reason why? 'Cause this hampers inputs of any other size than the onnx sample input. However, adding the attention_mask object to the dyanmic_inputs set resolves the issue, able to convert+test the model. Please let me know if this needs to be changed, I can open a PR, or somebody from the HF side can amend the changes instead. |
Even after solving the attention mask issue I still wasn't able to get faster model after converting bart to onnx. Perhaps quantization could help, but like, on the same text I got 6sec on pytorch model GPU and 70sec on onnx optimized graph. |
This is was designed as an example of showing how to export BART + Beam Search to ONNX successfully. It doesn't cover all of scenarios. Your PR is appreciated to make it better. Thanks! |
I tested the versions of the major packages. It is determined that upgrading pytorch from 1.8.0 to 1.9.1 can solve this bug.However in 1.9.1 pytorch does not support opset_version 14 and needs to be upgraded to 1.10.0. |
Good catch! Fixed in #14310 |
Hey @polly-morphism @diruoshui, given the PyTorch version fix in #14310 can we now close this issue? |
Yes, thank you! |
Environment info
onnx 1.10.2
onnxruntime 1.9.0
transformers
version: transformers 4.13.0.dev0Who can help
@fatcat-z @mfuntowicz @sgugger, @patil-suraj
Information
Model I am using: BartForConditionalGeneration
The problem arises when using:
To reproduce
Steps to reproduce the behavior:
Expected behavior
BART is converted to onnx with no issues
The text was updated successfully, but these errors were encountered: