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 in the code/modeling.py #8

Open
fanbowen232218094636-spec opened this issue Jun 22, 2022 · 2 comments
Open

Some problems in the code/modeling.py #8

fanbowen232218094636-spec opened this issue Jun 22, 2022 · 2 comments

Comments

@fanbowen232218094636-spec

Hello, I encountered something I didn't understand in the process of reading the code. If you have time, can you help me point it out?
At line 99 of the code/modeling.py, this is:
if posi_emb is not None:
eps=1e-10
batch_size = key_layer.size(0)
patch = key_layer
ad_out, loss_ad = lossZoo.adv_local(patch[:,:,1:], ad_net, is_source)
entropy = - ad_out * torch.log2(ad_out + eps) - (1.0 - ad_out) * torch.log2(1.0 - ad_out + eps)
entropy = torch.cat((torch.ones(batch_size, self.num_attention_heads, 1).to(hidden_states.device).float(), entropy), 2)
trans_ability = entropy if self.vis else None # [B12197]
entropy = entropy.view(batch_size, self.num_attention_heads, 1, -1)
attention_probs = torch.cat((attention_probs[:,:,0,:].unsqueeze(2) * entropy, attention_probs[:,:,1:,:]), 2)
What I don't understand is, is this place a place to fight against discrimination losses? Which part of Vit did you improve?

@fanbowen232218094636-spec
Copy link
Author

Hello, I seem to understand the code above. Is it an improvement of the TAM module you defined? Then I have another question, that is, I want to learn how you can only adapt to the confrontation of discriminators on the basis of VIT? Is the first part of your work in code modeling.py Which part of ?

@viyjy
Copy link
Collaborator

viyjy commented Jul 8, 2022

Hi, thanks for your interest in our paper.
I don't fully understand "only adapt to the confrontation of discriminators on the basis of VIT", can you elaborate it further? Thanks.

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