-
Notifications
You must be signed in to change notification settings - Fork 26.7k
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
Add onnx export of models with a multiple choice classification head #16758
Add onnx export of models with a multiple choice classification head #16758
Conversation
The documentation is not available anymore as the PR was closed or merged. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good on my side, thanks for working on this! Just make sure to run make fix-copies
and make style
on your branch to fix the quality issues.
Thanks for the review as well as the reminder @sgugger ! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding this @echarlaix - it looks great to me!
I think there's a few more models that support multiple choice classification and have an ONNX export:
- BigBird
- Data2VecText
- Electra
- FlauBERT
Would you like to include them in this PR too?
We should also do a final run of the slow tests before merging to make sure everything passes:
RUN_SLOW=1 pytest tests/onnx/test_onnx_v2.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect, thanks a lot for taking care of this @echarlaix !
num_choices, fixed_dimension=OnnxConfig.default_fixed_num_choices, num_token_to_add=0 | ||
) | ||
dummy_input = dummy_input * num_choices | ||
tokenized_input = preprocessor(dummy_input, text_pair=dummy_input) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would just add a small comment to make clear what's happening here.
What do you think?
tokenized_input = preprocessor(dummy_input, text_pair=dummy_input) | |
# Shape is [batch_size x num_choices, seq_length] | |
tokenized_input = preprocessor(dummy_input, text_pair=dummy_input) |
Thanks for the reviews @lewtun and @michaelbenayoun. |
Thanks for iterating on this @echarlaix - it looks great! |
…uggingface#16758) * Add export of models with a multiple-choice classification head
This PR adds the export support of models with a multiple-choice classification head, resolving #16695
This includes the following additions:
"multiple-choice"
feature was added to the corresponding model topologiesinputs
method of the models correspondingOnnxConfig
were modified to support the additional dynamic axis corresponding to the number of candidates