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

Prompt tuning label embedding #6

Closed
Even-ok opened this issue Mar 20, 2023 · 1 comment
Closed

Prompt tuning label embedding #6

Even-ok opened this issue Mar 20, 2023 · 1 comment

Comments

@Even-ok
Copy link

Even-ok commented Mar 20, 2023

Why is the label embedding in stage2 initialized by nn.embedding instead of CLIP text_encoder?

self.token_embedding = nn.Embedding(args.vocab_size, args.transformer_width)


self.label_emb = torch.zeros((len(self.name_lens), max(self.name_lens), self.transformer_width)).to(self.device)  
for i, embed in enumerate(self.token_embedding(self.label_token)):  
    self.label_emb[i][:self.name_lens[i]] = embed[4:4+self.name_lens[i]].clone().detach()  
@sunanhe
Copy link
Owner

sunanhe commented Mar 20, 2023

Hi,

Thanks for your attention and problem. During the second stage, the token embeddings of label text are fixed. So, we use a nn.Embedding to save them.

I will close the issue. If you still have any problems, plz tell me.

Best,
Sunan.

@sunanhe sunanhe closed this as completed Mar 20, 2023
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