Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] DINOv2 pretrained vit weights #1779

Closed
seefun opened this issue Apr 18, 2023 · 5 comments
Closed

[FEATURE] DINOv2 pretrained vit weights #1779

seefun opened this issue Apr 18, 2023 · 5 comments
Labels
enhancement New feature or request

Comments

@seefun
Copy link
Contributor

seefun commented Apr 18, 2023

Is your feature request related to a problem? Please describe.
dinov2 has been open sourced with the pretrained vit weight. Could it be added to timm?
image
image

@seefun seefun added the enhancement New feature or request label Apr 18, 2023
@rwightman
Copy link
Collaborator

yeah, it's fairly easy to add, especially with the recent eva.py variant as it includes the swiglu, just needs a slight remap as most of the model they use is derived from timm at some point, will do but not urgent level priority since it's a non-commercial license and all :)

@leng-yue
Copy link
Contributor

leng-yue commented May 6, 2023

As I am also relying on DINOv2 for my work, I will o implement it and submit a pull request within the next few days.

@leng-yue
Copy link
Contributor

leng-yue commented May 7, 2023

I have implemented the small, base, and large models, and they appear to be functioning correctly. However, I need to fix the SwiGLU before proceeding with the implementation of the giant model.

Specifically, the code below attempts to initialize a non-existent linear fc1a, which results in an error:

nn.init.ones_(self.fc1a.bias)
nn.init.normal_(self.fc1a.weight, std=1e-6)

Additionally, the official repository supports different image sizes than 518 by dynamically resizing the positional embedding during inference. I am uncertain about the best approach to incorporate this feature into timm.

@leng-yue
Copy link
Contributor

leng-yue commented May 7, 2023

Update: I fixed the SwiGLU bug and updated the giant model.

@rwightman
Copy link
Collaborator

added thanks to @leng-yue ... will update README shortly before next release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants