Skip to content

[Maskformer] Add MaskFormerSwin backbone#20344

Merged
NielsRogge merged 16 commits into
huggingface:mainfrom
NielsRogge:add_maskformer_swin_backbone
Nov 28, 2022
Merged

[Maskformer] Add MaskFormerSwin backbone#20344
NielsRogge merged 16 commits into
huggingface:mainfrom
NielsRogge:add_maskformer_swin_backbone

Conversation

@NielsRogge

@NielsRogge NielsRogge commented Nov 21, 2022

Copy link
Copy Markdown
Collaborator

What does this PR do?

This is part 2 of 3 of the big #20204 PR.

This PR adds MaskFormerSwin to the AutoBackbone API. This ensures that the model can be used as backbone with the MaskFormer framework.

As it makes more sense to move MaskFormerSwin to its own modeling files, this PR implements it in a separate modeling_maskformer_swin.py file, along with a configuration implemented in configuration_maskformer_swin.py.

To do:

@HuggingFaceDocBuilderDev

HuggingFaceDocBuilderDev commented Nov 21, 2022

Copy link
Copy Markdown

The documentation is not available anymore as the PR was closed or merged.

@NielsRogge NielsRogge force-pushed the add_maskformer_swin_backbone branch from ac15e04 to 692be5a Compare November 22, 2022 10:30
@NielsRogge NielsRogge marked this pull request as ready for review November 22, 2022 12:58
@NielsRogge NielsRogge requested a review from sgugger November 22, 2022 12:58

@sgugger sgugger left a comment

Copy link
Copy Markdown
Collaborator

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, it makes the code of Maskformer much cleaner!

Comment thread src/transformers/models/maskformer/configuration_maskformer_swin.py Outdated
Comment thread src/transformers/models/maskformer/modeling_maskformer.py Outdated
super().__init__()
self.encoder = MaskFormerSwinTransformerBackbone(config.backbone_config)

# TODD: add method to load pretrained weights of backbone

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's not the job the init, it's more the job of from_pretrained.

Comment thread src/transformers/models/maskformer/modeling_maskformer.py Outdated
Comment thread src/transformers/models/maskformer/modeling_maskformer.py
Comment thread src/transformers/models/maskformer/test.py Outdated
Comment thread tests/models/maskformer/test_modeling_maskformer_swin.py Outdated
Comment thread utils/check_copies.py Outdated
Comment thread utils/check_repo.py Outdated
Comment thread utils/check_repo.py
@NielsRogge NielsRogge force-pushed the add_maskformer_swin_backbone branch from 322dd71 to 8119850 Compare November 28, 2022 17:03
Comment thread docs/source/en/index.mdx
@NielsRogge NielsRogge requested a review from sgugger November 28, 2022 17:10
Comment thread src/transformers/models/maskformer/configuration_maskformer_swin.py Outdated
@NielsRogge NielsRogge merged commit 6dc884a into huggingface:main Nov 28, 2022
mpierrau pushed a commit to mpierrau/transformers that referenced this pull request Dec 15, 2022
* First draft

* Fix backwards compatibility

* More fixes

* More fixes

* Make backbone more general

* Improve backbone

* Improve test

* Fix config checkpoint

* Address comments

* Use model_type

* Address more comments

* Fix special model names

* Remove MaskFormerSwinModel and MaskFormerSwinPreTrainedModel from main init

* Fix typo

* Update backbone

* Apply suggestion

Co-authored-by: Niels Rogge <nielsrogge@Nielss-MacBook-Pro.local>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants