
该工具用于保存Stable Diffusion的Unet的attention maps和features,之前的写的太烂了。这次直接用了P2P的修改了下
github:https://github.com/wthu12138/Registeration-in-Diffusers
# Registeration in Diffusers
This tool is for registering cross-attention map, self-attention map and features in Stable Diffusion using diffusers. ## Installation There are 2 versions of this tool, one is for diffusers\==0.15.0, which is used in Prompt-to-Prompt another one is for diffusers\==0.27.2 ```bash #for diffusers==0.15.0 cd ./v1 pip install -r requirements_v1.txt #for diffusers==0.27.2 cd ./v2 pip install -r requirements_v2.txt ``` ## Usage ```bash #for diffusers==0.15.0 cd ./v1 #for diffusers==0.27.2 cd ./v2 ``` And then just run the `main_xxx_vx.py` - In this implementation, we use default settings which have 50 inference steps. Here is how we store the attentions and features. - We use a dict, the keys are layer name, the values are lists which store attention maps or features for all inference steps.  - Finally, because we use a pipeline, you can **debug** and use `editor.self_attns`, `editor.cross_attns` or `editor.feature_map` to see the results.