From e4b179e027c531884dd28515147bbdbaea6e38a8 Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Mon, 15 Apr 2024 11:43:51 -0400 Subject: [PATCH] check attention availability --- CHANGELOG.md | 3 ++- modules/sd_models.py | 9 ++++++++- wiki | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3193da55f..46cd9da73 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ - PixArt-Σ requires `diffusers-0.28.0.dev0` -## Update for 2024-04-13 +## Update for 2024-04-15 - **Features**: - **Gallery**: list, preview, search through all your images and videos! @@ -81,6 +81,7 @@ - face-hires compatibility with control modules - loading safetensors embeddings - css fixes + - check if attention processor is compatible with model ## Update for 2024-03-19 diff --git a/modules/sd_models.py b/modules/sd_models.py index 46155fa7c..fe7abe86b 100644 --- a/modules/sd_models.py +++ b/modules/sd_models.py @@ -1269,7 +1269,10 @@ def set_diffuser_pipe(pipe, new_pipe_type): if get_diffusers_task(pipe) == new_pipe_type: return pipe # skip specific pipelines - if pipe.__class__.__name__ == 'StableDiffusionReferencePipeline' or pipe.__class__.__name__ == 'StableDiffusionAdapterPipeline' or 'Onnx' in pipe.__class__.__name__: + n = pipe.__class__.__name__ + if n in ['StableDiffusionReferencePipeline', 'StableDiffusionAdapterPipeline', 'AnimateDiffPipeline']: + return pipe + if 'Onnx' in pipe.__class__.__name__: return pipe sd_checkpoint_info = getattr(pipe, "sd_checkpoint_info", None) @@ -1311,6 +1314,10 @@ def set_diffuser_pipe(pipe, new_pipe_type): def set_diffusers_attention(pipe, attention): + if attention is None: + return + if not hasattr(pipe, "_get_signature_keys"): + return module_names, _ = pipe._get_signature_keys(pipe) # pylint: disable=protected-access modules = [getattr(pipe, n, None) for n in module_names] modules = [m for m in modules if isinstance(m, torch.nn.Module) and hasattr(m, "set_attn_processor")] diff --git a/wiki b/wiki index 15c1c779f..9c936097e 160000 --- a/wiki +++ b/wiki @@ -1 +1 @@ -Subproject commit 15c1c779f186245f63b96f2f4cb0889da7817f7d +Subproject commit 9c936097e6c6c9344cb0a7b80d85bfd3ca33bb1f