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

a bit curious, as claimed in the paper: In contrast, we use the pre-trained Stable Diffusion models, without additional training #29

Open
XiudingCai opened this issue Jul 31, 2023 · 1 comment

Comments

@XiudingCai
Copy link

Thanks to the authors for their amazing work! But I'm a bit curious, as claimed in the paper: In contrast, we use the pre-trained Stable Diffusion models, without additional training. But I noticed that in the actual code, gradient optimization is still involved.

loss = 0.0
for name, module in self.unet.named_modules():
module_name = type(module).name
if module_name == "CrossAttention" and 'attn2' in name:
curr = module.attn_probs # size is num_channel,s*s,77
ref = d_ref_t2attn[t.item()][name].detach().to(device)
loss += ((curr - ref) ** 2).sum((1, 2)).mean(0)
loss.backward(retain_graph=False)
opt.step()

@GaParmar
Copy link
Collaborator

Hi @XiudingCai ,

Thank you for your interest in the paper!
We indeed compute the gradients during inference for our cross-attention guidance.
These gradients are not used for updating the model parameters.

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