-
Notifications
You must be signed in to change notification settings - Fork 31.8k
Add UperNet #20648
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 UperNet #20648
Conversation
41fe6b6 to
f899eea
Compare
|
The documentation is not available anymore as the PR was closed or merged. |
7e880ea to
11db99f
Compare
70736a5 to
963dc11
Compare
sgugger
left a comment
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 working on this new model. Left a couple of comments.
d657041 to
f415981
Compare
| ) | ||
| if isinstance(backbone_config, dict): | ||
| config_class = CONFIG_MAPPING[backbone_model_type] | ||
| backbone_config = config_class.from_dict(backbone_config) |
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.
Maybe raise an error if then the type is not a PretrainedConfig?
alaradirik
left a comment
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!
Left a few minor comments but everything looks good apart from the issues/comments related to configuration and model parameter initialisation (+ organization name update) and works as expected.
src/transformers/models/upernet/convert_convnext_upernet_to_pytorch.py
Outdated
Show resolved
Hide resolved
src/transformers/models/upernet/convert_swin_upernet_to_pytorch.py
Outdated
Show resolved
Hide resolved
sgugger
left a comment
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.
LGTM on the model initialization. One last comment on the image processor: it needs to be added in the auto mapping, and since it seems to be a full copy of the SegformerImageProcessor, you should re-use it in the auto-mapping and not introduce a new image processor here.
sgugger
left a comment
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 all your work on this model!
|
Thanks for the review, I'm waiting for the authors to respond regarding the creation of an organization on the hub. |
586eebc to
4369af8
Compare
What does this PR do?
This PR adds the classic UperNet framework to Transformers.
Many papers that introduce a new vision backbone, such as BEiT, ConvNeXt, Swin,... benchmark their model on downstream tasks such as semantic segmentation and object detection. All of these papers use the UperNet framework (introduced in 2018) when evaluating their backbone on semantic segmentation.
Hence, this PR implements this framework, making use of the new AutoBackbone API to make the following possible:
In the code above, we're instantiating the UperNet framework with Swin Transformer as backbone. The code looks equivalent for another backbone, like ConvNeXt:
To do:
from_pretrainedof backbones => will be done in a follow-up PRsegmentation_mapsas optional input