wooyeolBaek / attention-map

🚀 Cross attention map tools for huggingface/diffusers
https://huggingface.co/spaces/We-Want-GPU/diffusers-cross-attention-map-SDXL-t2i
MIT License
150 stars 9 forks source link

function of set_layer_with_name_and_path #7

Closed yj373 closed 3 months ago

yj373 commented 4 months ago

Hello!

Thank you for your awesome work! I am trying to understand your code. For the method def set_layer_with_name_and_path, I am wondering what the main function of this method is. It seems like you are trying to update the forward function of each target module into the customized forward function in module.py. My questions are as follows:

  1. Is my understanding correct?
  2. What do current_path and new_path mean here? And why do you keep track of them?

I would really appreciate it if you could help me understand your code. Thank you so much!

wooyeolBaek commented 3 months ago

@yj373 Yes, that’s correct. The current_path and new_path were from an older version, and it looks like they weren’t removed when I updated the code. They’re unnecessary now, so you can just ignore them. Thanks for pointing that out, by the way.