castorini / daam

Diffusion attentive attribution maps for interpreting Stable Diffusion.
MIT License
689 stars 63 forks source link

How to use without a pipeline? #42

Closed okaris closed 1 year ago

okaris commented 1 year ago

I am not using the HF pipeline in some of my scripts. Is it possible to hook to unet only to collect probs for specific tokens?

daemon commented 1 year ago

With some modifications, yes. You'll need to look at trace.py and adapt the necessary parts, notably ones called by PipelineHooker (https://github.com/castorini/daam/blob/main/daam/trace.py#L132).