Open innat-asj opened 2 months ago
PyTorch 2.2 has come with Flash Attention-v2. This is better for both memory and speed than PyTorch 1.x's native attention. If you upgrade your PyTorch it might not be necessary to use xFormers. Is it necessary to use PyTorch 1.x for you?
I've already mentioned the packages with versions that I need.
Could you try this for now?
pipe = AutoPipelineForInpainting.from_pretrained(
"runwayml/stable-diffusion-inpainting",
safety_checker=None,
torch_dtype=torch.float16,
)
+pipe.enable_xformers_memory_efficient_attention()
pipe.load_ip_adapter(
"h94/IP-Adapter",
subfolder="models",
weight_name="ip-adapter-plus_sd15.bin"
)
pipe.set_ip_adapter_scale(0.7)
pipe.enable_model_cpu_offload()
-pipe.enable_xformers_memory_efficient_attention()
Hi @innat-asj Could you try what @tolgacangoz is suggesting and move enabling xformers before loading the IP Adapter. The issue seems to be coming from how the Attention Processors are configured.
Moving xformers before ip-adapter works. Thanks. The error message could be improved though.
Thanks for the suggestion. Do you maybe want to open a PR?
Describe the bug
I've built the following pipeline with inpainting and Ip-adapter. And to reduce the memory footprint I also enabled CPU offload and efficient transformer methods, which causes the reported error.
Reproduction
Logs
System Info
Who can help?
@sayakpaul @yiyixuxu @DN6
Mainly it's caused for