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

question about self.pos_embed in models_dww.py #10

Closed
stillwaterman opened this issue Jun 13, 2024 · 2 comments
Closed

question about self.pos_embed in models_dww.py #10

stillwaterman opened this issue Jun 13, 2024 · 2 comments

Comments

@stillwaterman
Copy link

stillwaterman commented Jun 13, 2024

Hi, nice work!
I found this code ‘self.pos_embed = nn.Parameter(torch.zeros(1, self.num_patches + 1, embed_dim), requires_grad=False) # fixed sin-cos embedding’ in models_dww.py. I think self.pos_embed is not a fixed sin-cos embedding, it's a fixed zeros embedding, and adding it to patch embedding has no effect. I want to know what the purpose of this line of code is. @ShadowXZT

@xiong-zhitong
Copy link
Member

xiong-zhitong commented Jun 13, 2024

Hi, thanks for your interests!
During training, pos_embed is initialized here.
During inference, we will load the parameters (fixed sin-cos embedding) from the pre-trained model.

@stillwaterman
Copy link
Author

thanks for reply! I understand now, close issue.

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

No branches or pull requests

2 participants