-
Notifications
You must be signed in to change notification settings - Fork 27.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
added deit onnx config #16887
added deit onnx config #16887
Conversation
The documentation is not available anymore as the PR was closed or merged. |
src/transformers/onnx/features.py
Outdated
@@ -286,6 +287,7 @@ class FeaturesManager: | |||
), | |||
"vit": supported_features_mapping("default", "image-classification", onnx_config_cls=ViTOnnxConfig), | |||
"beit": supported_features_mapping("default", "image-classification", onnx_config_cls=BeitOnnxConfig), | |||
"deit": supported_features_mapping("default", "image-classification", onnx_config_cls=DeiTOnnxConfig), |
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 saw that DeiT also have a DeiTForMaskedImageModeling
implementation, is it a feature also available in onnx ?
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.
BeiT also has BeiTForMaskedImageModeling, but there isn't anything for that in features.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.
You can add something like
"masked-im": AutoModelForMaskedImageModeling
to the _TASKS_TO_AUTOMODELS
attribute of the FeaturesManager
. I don't think we currently support this feature for TensorFlow, so no need to include this in __TASKS_TO_TF_AUTOMODELS
.
Feel free to then include this feature as part of vit
, deit
, and beit
Also pinging @LysandreJik, @lewtun and @NielsRogge because he did the implementation of DeiT. Btw Did you try to convert one |
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 DEIT to the ONNX exporter @rushic24 ! Overall this looks great and I think it would be neat if we can also include the masked image modelling feature :)
src/transformers/onnx/features.py
Outdated
@@ -286,6 +287,7 @@ class FeaturesManager: | |||
), | |||
"vit": supported_features_mapping("default", "image-classification", onnx_config_cls=ViTOnnxConfig), | |||
"beit": supported_features_mapping("default", "image-classification", onnx_config_cls=BeitOnnxConfig), | |||
"deit": supported_features_mapping("default", "image-classification", onnx_config_cls=DeiTOnnxConfig), |
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.
You can add something like
"masked-im": AutoModelForMaskedImageModeling
to the _TASKS_TO_AUTOMODELS
attribute of the FeaturesManager
. I don't think we currently support this feature for TensorFlow, so no need to include this in __TASKS_TO_TF_AUTOMODELS
.
Feel free to then include this feature as part of vit
, deit
, and beit
Thanks @lewtun , I just added those. I'm trying to add a README to ONNXConfigForAll, How does onnx work in ViT?
|
Could you check on netron.app what are the inputs of the onnx converted model and then check if the |
And inputs itself is a dictionary The input as seen from netron is pixel_values, I did try dict(inputs), inputs, list(inputs) |
I just figured it out. You can find it here https://huggingface.co/OWG/DeiT :-) |
It seems really good! 🤗 |
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 iterating on this @rushic24 and great job on pushing a model to the Hub 😍 !
This LGTM so gently pinging @sgugger for final approval
@@ -102,6 +104,7 @@ class FeaturesManager: | |||
"multiple-choice": AutoModelForMultipleChoice, | |||
"question-answering": AutoModelForQuestionAnswering, | |||
"image-classification": AutoModelForImageClassification, | |||
"masked-im": AutoModelForMaskedImageModeling, |
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.
For reviewers: we picked masked-im
as the name to match the pre-existing masked-lm
used for language modeling
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. It all looks good but there is a datasets
submodule added in this PR that should be removed before it can be merged.
Thanks for the fix! |
* added deit onnx config
What does this PR do?
Added DeiT OnnxConfig to make this model available for conversion
@chainyo
#16308
Fixes # (issue)
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.