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

Some problems about Code #19

Open
123456789asdfjkl opened this issue Mar 1, 2023 · 3 comments
Open

Some problems about Code #19

123456789asdfjkl opened this issue Mar 1, 2023 · 3 comments

Comments

@123456789asdfjkl
Copy link

FAN/models/fan.py

Lines 311 to 315 in ee1b7df

x_res = x
cls_token = x[:, 0:1]
cls_token = self.gamma2 * self.mlp(cls_token)
x = torch.cat([cls_token, x[:, 1:]], dim=1)
x = x_res + self.drop_path(x)

Hi! Thank you for your great work! According to CaiT, I think the code should be in the following form:
cls_token = x[:, 0:1] + self.drop_path(self.gamma2 * self.mlp(x[:, 0:1] ))
x = torch.cat([cls_token, x[:, 1:], dim=1)

@Youskrpig
Copy link

Same question. The forward function in LayerScaleBlockClassAttn realized in timm is:
x = x + self.drop_path(self.gamma1 * self.attn(self.norm1(x)))
x = x + self.drop_path(self.gamma2 * self.mlp(self.norm2(x)))

@zhoudaquan
Copy link
Contributor

FAN/models/fan.py

Lines 311 to 315 in ee1b7df

x_res = x
cls_token = x[:, 0:1]
cls_token = self.gamma2 * self.mlp(cls_token)
x = torch.cat([cls_token, x[:, 1:]], dim=1)
x = x_res + self.drop_path(x)

Hi! Thank you for your great work! According to CaiT, I think the code should be in the following form:
cls_token = x[:, 0:1] + self.drop_path(self.gamma2 * self.mlp(x[:, 0:1] ))
x = torch.cat([cls_token, x[:, 1:], dim=1)

Hi, thanks for pointing this out. There are indeed some difference between our implementation and CaiT. But the experiments in the paper are all using the method in the released code…

@zhoudaquan
Copy link
Contributor

Same question. The forward function in LayerScaleBlockClassAttn realized in timm is:
x = x + self.drop_path(self.gamma1 * self.attn(self.norm1(x)))
x = x + self.drop_path(self.gamma2 * self.mlp(self.norm2(x)))

Hi, thanks for pointing this out. There are indeed some difference between our implementation and CaiT. But the experiments in the paper are all using the method in the released code…

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

3 participants