From 7d7bcb9684b5b9b535ee74ff9d19de2af3791ab8 Mon Sep 17 00:00:00 2001 From: Disty0 Date: Fri, 13 Dec 2024 23:01:53 +0300 Subject: [PATCH] Fix balanced offload with Cascade --- modules/intel/ipex/diffusers.py | 2 +- modules/sd_models.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/intel/ipex/diffusers.py b/modules/intel/ipex/diffusers.py index 2af602558..5bf5bbe39 100644 --- a/modules/intel/ipex/diffusers.py +++ b/modules/intel/ipex/diffusers.py @@ -1,7 +1,7 @@ import os from functools import wraps, cache import torch -import diffusers #0.29.1 # pylint: disable=import-error +import diffusers # pylint: disable=import-error from diffusers.models.attention_processor import Attention # pylint: disable=protected-access, missing-function-docstring, line-too-long diff --git a/modules/sd_models.py b/modules/sd_models.py index c39c0263e..c5875c61f 100644 --- a/modules/sd_models.py +++ b/modules/sd_models.py @@ -481,6 +481,8 @@ def apply_balanced_offload_to_module(pipe): keys = [k for k in keys if k not in exclude and not k.startswith('_')] for module_name, module_size in get_pipe_modules(pipe): # pylint: disable=protected-access module = getattr(pipe, module_name, None) + if module is None: + continue network_layer_name = getattr(module, "network_layer_name", None) device_map = getattr(module, "balanced_offload_device_map", None) max_memory = getattr(module, "balanced_offload_max_memory", None)