-
Notifications
You must be signed in to change notification settings - Fork 28.5k
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 ResNet to models exportable with ONNX #16948
Add ResNet to models exportable with ONNX #16948
Conversation
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. |
|
||
@property | ||
def atol_for_validation(self) -> float: | ||
return 1e-4 |
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.
Hey @chamidullinr nice PR, did you try the conversion config with the default --atol=1e-5
before putting it to 1e-4
?
If you are okay you could push a ResNet
ONNX converted model to the ONNXConfig for all organisation, it would be awesome! 🤗
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 pushed a ResNet-50
ONNX converted model. And I set --atol=1e-3
because some tests were failing.
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 the first non-Transformer model to our ONNX exporter @chamidullinr !
Apart from @chainyo's comment, this all looks good to me, so can you please check that the slow tests pass by running:
RUN_SLOW=1 pytest tests/onnx/test_onnx_v2.py -s -k "resnet"
Gently pinging @sgugger for final approval 🤗
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 the PR. LGTM module existing comments :-)
Thanks for the suggestions. One test fails when running slow tests. The error is:
Should I set --atol=1e-3 or is there some way to fix this? |
Ah yes, some models require a lower tolerance due to their architectures. Setting |
* add roformer onnx config
* Avoid repeated per-lang filtering * Language groups and logits preprocessing * Style
* Add first draft * Improve script and README * Improve README * Apply suggestions from code review * Improve script, add link to resulting model * Add corresponding test * Adjust learning rate
Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
1. Fixes evaluation errors popping up when you train/eval on squad v2 (one was newly encountered and one that was previously reported Running SQuAD 1.0 sample command raises IndexError huggingface#15401 but not completely fixed). 2. Removes boolean arguments that don't use store_true. Please, don't use these: *ANY non-empty string is being converted to True in this case and this clearly is not the desired behavior (and it creates a LOT of confusion). 3. All no-trainer test scripts are now saving metric values in the same way (with the right prefix eval_), which is consistent with the trainer-based versions. 4. Adds forgotten model.eval() in the no-trainer versions. This improved some results, but not everything (see the discussion in the end). Please, see the F1 scores and the discussion below.
…#16946) * Add fix * Apply suggestion from code review Co-authored-by: Niels Rogge <nielsrogge@Nielss-MacBook-Pro.local>
* Fix `distributed_concat` with scalar tensor * Update trainer_pt_utils.py
BertModelForSequenceClassification -> BertForSequenceClassification
…ace#16947) * Fix multiple deletions of the same files in save_pretrained * Add is_main_process argument
* Fixup all examples
* Fix doc notebooks links * Remove missing section
Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
* Add -e flag * add check * create new keys * run python setup.py build install * add comments * change to develop Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
The emoji version must be either 0.5.4 or 0.6.0. Newer emoji versions have been updated to newer versions of the Emoji Charts, thus not consistent with the one used for pre-processing the pre-training Tweet corpus (i.e. not consistent with the vocab).
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread. Please note that issues that do not follow the contributing guidelines are likely to be ignored. |
Can't we rebase this branch and add the code for ResNet ? |
Pretty cool! |
What does this PR do?
I added OnnxConfig to make ResNet model available for ONNX conversion.
Issue #16308
Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.