Skip to content

Conversation

@NielsRogge
Copy link
Contributor

@NielsRogge NielsRogge commented Nov 21, 2022

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
Copy link

HuggingFaceDocBuilderDev commented Nov 21, 2022

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
Copy link
Collaborator

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

super().__init__()
self.encoder = MaskFormerSwinTransformerBackbone(config.backbone_config)

# TODD: add method to load pretrained weights of backbone
Copy link
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.

@NielsRogge NielsRogge force-pushed the add_maskformer_swin_backbone branch from 322dd71 to 8119850 Compare November 28, 2022 17:03
@NielsRogge NielsRogge requested a review from sgugger November 28, 2022 17:10
@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 <[email protected]>
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