castorini / daam

Diffusion attentive attribution maps for interpreting Stable Diffusion.
MIT License
696 stars 64 forks source link

Time_idx #15

Closed joaanna closed 1 year ago

joaanna commented 1 year ago

Hi,

Thanks for the code! Quick question, when computing the heatmaps for the first timestep compute_global_heat_map(prompt, time_idx=time_idx)

time_idx=0 would be the first denoising step in other words step 999. as per scheduler with 1000 steps? or rather that would be the last denoising step same as the time step from scheduler?

Thanks!

daemon commented 1 year ago

It would be the first step. I ended up taking it out of the code (#9) since the old approach was taking up a lot of RAM, but I plan to add time_idx back in the future.

joaanna commented 1 year ago

sorry can you clarify? the first step as in the first denoising step == timescheduler step 999 OR first step as in last denoising step?

daemon commented 1 year ago

Oh, to be honest I'm not sure what time scheduler step 999 is, but time_idx refers specifically to this:

latents = ...  # initialize

for time_idx, time_step in enumerate(ts_schedule):
    noise_pred = unet(time_step, latents)
    latents = solve(latents, noise_pred, time_step)

In that snippet, time_idx has the same meaning as our time_idx. It would be the heat maps associated with the (time_idx + 1)th call to the U-Net. So for time_idx == 0, it would be the first call to the U-Net.

joaanna commented 1 year ago

Great, thanks so thats the first time step in the denoising process.