Adding RTDETRv2
Author: jadechoghari
Pull request: yes
Labels: name: New model

name: Vision

name: run-slow

name: Modular

# What does this PR do?

This PR add RTDETRv2 into the Transformers library. There is a new thing in transformers called **modular**, which adds new models by creating a `modeling_modelname.py` file. Since RTDETRv2 only updates the decoder part while keeping the rest of the model unchanged, it serves as an ideal use case for this modular approach.

### What’s Left:
- [x] Fix the modular -> modeling cookie cutter setup
- [x] Remove the `scratch` folder (auto-generated by the `add-model` cookie cutter)
- [x] Add support for resnet

Colab to replicate original author logits: https://colab.research.google.com/drive/1Vql-9JuFKz7N7l83NmHPP2E1ZyGZnpzX?usp=sharing

Comments:
@jadechoghari Hi thanks for working this, original PR for RTDetr-v2 can be found here. Perhaps you can fill the blank based on this
https://github.com/huggingface/transformers/pull/33244

Hi @SangbumChoi, yes - this is a new PR since we're using a new concept called modular. 
also, thank you so much for your work - lot of stuff here is based on it especially the v1 implementation! 

Great. FYI I also have confirmed that there is slight tolerance issue of converting v2 weight since it has difference in MSDA. 

yes nw, I checked your PR!

great! - i'll update accordingly - thx!

Hey @Cyrilvallez, lmk if anything else needs to be updated for Modular - i've incorporated all your suggestions and fixes!

Changes updated @Cyrilvallez !
Adding the make fixup error:
``` txt
utils/check_modular_conversion.py
Traceback (most recent call last):
  File "/home/user/app/transformers/utils/check_modular_conversion.py", line 75, in <module>
    non_matching_files += compare_files(modular_file_path, args.fix_and_overwrite)
  File "/home/user/app/transformers/utils/check_modular_conversion.py", line 55, in compare_files
    generated_modeling_content = convert_modular_file(modular_file_path)
  File "/home/user/app/transformers/utils/modular_model_converter.py", line 1447, in convert_modular_file
    for file, module in create_modules(cst_transformers).items():
  File "/home/user/app/transformers/utils/modular_model_converter.py", line 1387, in create_modules
    nodes_to_add, file_type, new_imports = get_class_node_and_dependencies(modular_mapper, class_name, node, files)
  File "/home/user/app/transformers/utils/modular_model_converter.py", line 1348, in get_class_node_and_dependencies
    relative_dependency_order = mapper.compute_relative_order(all_dependencies_to_add)
  File "/home/user/app/transformers/utils/modular_model_converter.py", line 739, in compute_relative_order
    remaining_dependencies.remove(class_name)
KeyError: 'RtDetrV2MultiheadAttention'
make: *** [Makefile:39: repo-consistency] Error 1
``` 


still in progress ignore the red CI

let's re-run the failed job as it failed because of a network issue apparently :)

run-slow: rt_detr_v2

This comment contains run-slow, running the specified jobs: ['models/rt_detr_v2'] ...

Hey @jadechoghari, I see the logits in tests are changed significantly after removing custom kernel attention, please, ensure it matches with the original implementation.

@qubvel ofc, i've added a notebook at the top of the PR to replicate the original author logits which matches the one in the testing :)! 

run-slow: rt_detr, rt_detr_v2

This comment contains run-slow, running the specified jobs: This comment contains run-slow, running the specified jobs:

models: ['models/rt_detr', 'models/rt_detr_v2']
quantizations: [] ...

The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_34773). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@jadechoghari congratulations on the second model merged 🤗 great work 🚀