From 2c64478e10dee43d7573e4f553918ccb113d1414 Mon Sep 17 00:00:00 2001 From: lllyasviel Date: Sun, 28 Jan 2024 10:23:29 -0800 Subject: [PATCH] Update diffusers_patcher.py --- modules_forge/diffusers_patcher.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules_forge/diffusers_patcher.py b/modules_forge/diffusers_patcher.py index 262bad88..83407749 100644 --- a/modules_forge/diffusers_patcher.py +++ b/modules_forge/diffusers_patcher.py @@ -23,8 +23,9 @@ class DiffusersModelPatcher: self.pipeline = pipeline_class.from_pretrained(*args, **kwargs) if hasattr(self.pipeline, 'unet'): - self.pipeline.unet.set_attn_processor(AttnProcessor2_0()) - print('Attention optimization applied to DiffusersModelPatcher') + if hasattr(self.pipeline.unet, 'set_attn_processor'): + self.pipeline.unet.set_attn_processor(AttnProcessor2_0()) + print('Attention optimization applied to DiffusersModelPatcher') self.pipeline = self.pipeline.to(device=offload_device, dtype=dtype) self.pipeline.eval()