Request to add D-FINE
Author: brockt96
Pull request: no
Labels: name: New model

name: Good Second Issue

name: Vision

name: contributions-welcome

### Model description

D-FINE is a RT-DETR based model that uses probability distributions as an intermediate representation from which bounding boxes are predicted.  This model has achieved SOTA results in real-time object detection with additional training data. https://paperswithcode.com/sota/real-time-object-detection-on-coco?p=d-fine-redefine-regression-task-in-detrs-as

### Open source status

- [x] The model implementation is available
- [X] The model weights are available

### Provide useful links for the implementation

Here is the link to the repository: https://github.com/Peterande/D-FINE. The weights are present on [Huggingface Hub](https://huggingface.co/Peterande/D-FINE/tree/main). The only github username I know of is @Peterande.

Comments:
Hi @brockt96! Thanks for opening this issue 🙌. D-FINE would be an amazing addition to Transformers! If you're interested in working on it, we'd be excited to support you. Otherwise, let's see if anyone in the community is eager to contribute to integrating this model. Let me know what you think! 🤗 

Hi @qubvel @brockt96! I could contribute into this model if for some reasons nobody is going to work on this. 

Hi @VladOS95-cyber that would be super cool! Feel free to open a PR. Cc'ing also @SangbumChoi who contributed RT-DETR

https://github.com/huggingface/transformers/pull/34773
https://github.com/huggingface/transformers/pull/33244
If you see these PR then it will be much more easier to do D-FINE as modular.

Hi @VladOS95-cyber, that's super cool! feel free to ping me when PR is open!

Since the model is based on RT-DETR, please, use `modular` for the model addition. And in addition to the above PRs, mentioned by @SangbumChoi it's worth looking at:

 - https://github.com/huggingface/transformers/issues/33916
 - https://huggingface.co/docs/transformers/modular_transformers
 - https://github.com/huggingface/transformers/tree/main/examples/modular-transformers


> Hi @brockt96! Thanks for opening this issue 🙌. D-FINE would be an amazing addition to Transformers! If you're interested in working on it, we'd be excited to support you. Otherwise, let's see if anyone in the community is eager to contribute to integrating this model. Let me know what you think! 🤗

I'd love to work it! Though I hasten to add that I have no freaking clue what I'm doing.😅 But, that's part of the reason why I want to do this. I want to learn. And I want to be able to tame these "researchy" models, as y'all call them. I think this will be a good experience all things considered.

> > Hi @brockt96! Thanks for opening this issue 🙌. D-FINE would be an amazing addition to Transformers! If you're interested in working on it, we'd be excited to support you. Otherwise, let's see if anyone in the community is eager to contribute to integrating this model. Let me know what you think! 🤗
> 
> I'd love to work it! Though I hasten to add that I have no freaking clue what I'm doing.😅 But, that's part of the reason why I want to do this. I want to learn. And I want to be able to tame these "researchy" models, as y'all call them. I think this will be a good experience all things considered.

Hi @brockt96! Are you going to work on it then?

> > > Hi @brockt96! Thanks for opening this issue 🙌. D-FINE would be an amazing addition to Transformers! If you're interested in working on it, we'd be excited to support you. Otherwise, let's see if anyone in the community is eager to contribute to integrating this model. Let me know what you think! 🤗
> > 
> > 
> > I'd love to work it! Though I hasten to add that I have no freaking clue what I'm doing.😅 But, that's part of the reason why I want to do this. I want to learn. And I want to be able to tame these "researchy" models, as y'all call them. I think this will be a good experience all things considered.
> 
> Hi @brockt96! Are you going to work on it then?

Yes. Although I won't be able to do so full-time.

> > > > Hi @brockt96! Thanks for opening this issue 🙌. D-FINE would be an amazing addition to Transformers! If you're interested in working on it, we'd be excited to support you. Otherwise, let's see if anyone in the community is eager to contribute to integrating this model. Let me know what you think! 🤗
> > > 
> > > 
> > > I'd love to work it! Though I hasten to add that I have no freaking clue what I'm doing.😅 But, that's part of the reason why I want to do this. I want to learn. And I want to be able to tame these "researchy" models, as y'all call them. I think this will be a good experience all things considered.
> > 
> > Hi @brockt96! Are you going to work on it then?
> 
> Yes. Although I won't be able to do so full-time.

If you're not available to do this, do let me know. I can take it up. :)

> > > > > Hi @brockt96! Thanks for opening this issue 🙌. D-FINE would be an amazing addition to Transformers! If you're interested in working on it, we'd be excited to support you. Otherwise, let's see if anyone in the community is eager to contribute to integrating this model. Let me know what you think! 🤗
> > > > 
> > > > 
> > > > I'd love to work it! Though I hasten to add that I have no freaking clue what I'm doing.😅 But, that's part of the reason why I want to do this. I want to learn. And I want to be able to tame these "researchy" models, as y'all call them. I think this will be a good experience all things considered.
> > > 
> > > 
> > > Hi @brockt96! Are you going to work on it then?
> > 
> > 
> > Yes. Although I won't be able to do so full-time.
> 
> If you're not available to do this, do let me know. I can take it up. :)

After thinking about it, truthfully, it'll probably be better if you take it up. But, I do still want to contribute. So let me know what I can do to support.

Hey @brockt96, ok, I'll take care of it

@VladOS95-cyber super cool 👍 feel free to ping me for any questions

> @VladOS95-cyber super cool 👍 feel free to ping me for any questions

@qubvel, sure, thank you!

@VladOS95-cyber could I try contribute if you didn't finish since there are not many first issues

@qubvel 

> @VladOS95-cyber could I try contribute if you didn't finish since there are not many first issues

hey, i'am currently working on it

This was fixed by #36261