transformers icon indicating copy to clipboard operation
transformers copied to clipboard

DINOv2 register support

Open audioXD opened this issue 1 year ago • 1 comments

What does this PR do?

This PR adds DINOv2 with registers as proposed in Vision Transformers Need Registers. My aim was to add registers with minimal code changes in a backward compatible way. My changes were made using the facebookresearch/dinov2 repository commits. I also had to add additional options for interpolation which caused me to comment and fix the intepolate embeddings method. (Said comments were written on the fly as I was understanding and changing the code and are biased, and can be removed). While doing that I added support for non square patch sizes which seamed like a bug since Dinov2PatchEmbeddings supported them, but the rest of the code didn't.

To do:

Fixes https://github.com/huggingface/transformers/issues/27379 Alternatives https://github.com/huggingface/transformers/pull/31832

Before submitting

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag members/contributors who may be interested in your PR.

audioXD avatar Jul 22 '24 01:07 audioXD

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the contributing guidelines are likely to be ignored.

github-actions[bot] avatar Aug 21 '24 08:08 github-actions[bot]