HyelinNAM / ContrastiveDenoisingScore

[CVPR2024] Official PyTorch implementation of "Contrastive Denoising Score(CDS) for Text-guided Latent Diffusion Image Editing"
https://arxiv.org/abs/2311.18608
88 stars 3 forks source link

inquiry to follow cross-attention in Figure6 #6

Closed john09282922 closed 6 months ago

john09282922 commented 6 months ago

Dear Hyelin,

I would like to follow cross-attention method on the figure 6 in your paper. How can I use cross-attention on your code through code modification?

thanks, john

HyelinNAM commented 6 months ago

Hi! @john09282922

Instead of 'attn1', use 'attn2' in below codes.

  1. save self-attention features https://github.com/HyelinNAM/ContrastiveDenoisingScore/blob/285d1ccce307e1d8c0298bcdfb29de7776b5d691/pipeline_cds.py#L166-L169

  2. get & load self-attention features > calculate cut loss https://github.com/HyelinNAM/ContrastiveDenoisingScore/blob/285d1ccce307e1d8c0298bcdfb29de7776b5d691/pipeline_cds.py#L190-L195