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 the cross attention #82

Open
qiguming opened this issue Dec 21, 2023 · 1 comment
Open

Question about the cross attention #82

qiguming opened this issue Dec 21, 2023 · 1 comment

Comments

@qiguming
Copy link

if crossattn:
detach = torch.ones_like(key)
detach[:, :1, :] = detach[:, :1, :]0.
key = detachkey + (1-detach)key.detach()
value = detachvalue + (1-detach)*value.detach()

Why stop the gradient of the first key-value pair here?

@nupurkmr9
Copy link
Collaborator

Hi,

Since the first start of the sentence token is always fixed, I noticed a small improvement when detaching it during the training. I guess this helps in better association between the "V* category" and the target image and thus improved generation on inference time prompt.

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