Add Mask2Former
Author: alaradirik
Pull request: yes

# What does this PR do?
Adds Mask2Former to transformers.
Original repo: https://github.com/facebookresearch/Mask2Former/
Paper: https://arxiv.org/abs/2112.01527

Co-authored with @shivalikasingh95 

To Do:
- [x] Fix model tests (hidden state shapes, loading the config)
- [X] Test model, visualize outputs
- [X] Update model cards


## Before submitting
- [ ] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
- [X ] Did you read the [contributor guideline](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md#start-contributing-pull-requests),
      Pull Request section?
- [X ] Was this discussed/approved via a Github issue or the [forum](https://discuss.huggingface.co/)? Please add a link
      to it if that's the case.
- [X ] Did you make sure to update the documentation with your changes? Here are the
      [documentation guidelines](https://github.com/huggingface/transformers/tree/main/docs), and
      [here are tips on formatting docstrings](https://github.com/huggingface/transformers/tree/main/docs#writing-source-documentation).
- [X] Did you write any new necessary tests?





Comments:
_The documentation is not available anymore as the PR was closed or merged._

Gently pinging @sgugger here for a final review.

> Thanks for adding this new model! I have a couple of nits but nothing major, this is very clean already!

@sgugger Thanks for the review! I have resolved all comments from yesterday's review. Please do let me know if the code needs any further changes/improvements. Would be happy to take them up! 

So it seems there are 2 todo's left:

- [x] leverage AutoImageProcessor instead of adding a new one
- [x] make sure slow integration tests of Donut and Swin are still passing, possibly using `MaskFormerSwin` as backbone

> So it seems there are 2 todo's left:
> 
> * [x]  leverage AutoImageProcessor instead of adding a new one
> * [x]  make sure slow integration tests of Donut and Swin are still passing, possibly using `MaskFormerSwin` as backbone

Sure I'll connect with @alaradirik and we'll fix these shortly and update you.

@NielsRogge Just wanted to update that backbone for Mask2Former has been switched to `MaskFormerSwin`.
Changes to modeling_swin.py and modeling_donut_swin.py have been reverted so slow integration tests of Donut and Swin are passing now.

Conversion of all 30 checkpoints from [Mask2Former model zoo](https://github.com/facebookresearch/Mask2Former/blob/main/MODEL_ZOO.md) using swin backbone corresponding to all 4 datasets and segmentation tasks is done and are available on the Hub. I just need to update the model cards. Will finish that shortly too.  

Thank you! 

I'm just wondering why the issue was occurring only on Swin-base on one specific dataset. It would definitely be nice to clear that up, does it have to do with the image resolution?

For instance for UperNet (at #20648) I was able to perfectly convert all checkpoints that leverage Swin-base by using our `SwinBackbone`. This one was ported from the mmsegmentation library whose Swin implementation is [here](https://github.com/open-mmlab/mmsegmentation/blob/master/mmseg/models/backbones/swin.py#L166). So it's a bit strange. Might it be that we were just "lucky" with UperNet and OneFormer?