From 596f717a880d7f51c1e7b7e5d7f32de8982f0b00 Mon Sep 17 00:00:00 2001 From: fangruichong Date: Mon, 18 Nov 2024 12:04:21 +0800 Subject: [PATCH] fix lora switch --- onediff_sd_webui_extensions/onediff_lora.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/onediff_sd_webui_extensions/onediff_lora.py b/onediff_sd_webui_extensions/onediff_lora.py index 5d8f6a4df..75e926867 100644 --- a/onediff_sd_webui_extensions/onediff_lora.py +++ b/onediff_sd_webui_extensions/onediff_lora.py @@ -1,4 +1,7 @@ import torch + +import onediff_shared + from compile.utils import is_oneflow_backend from onediff.infer_compiler import DeployableModule @@ -36,8 +39,9 @@ def hijacked_activate(activate_func): def activate(self, p, params_list): activate_func(self, p, params_list) - if isinstance(p.sd_model.model.diffusion_model, DeployableModule): - onediff_sd_model: DeployableModule = p.sd_model.model.diffusion_model + sd_model = onediff_shared.current_unet_graph.graph_module + if isinstance(sd_model, DeployableModule): + onediff_sd_model: DeployableModule = sd_model for name, sub_module in onediff_sd_model.named_modules(): if not isinstance( sub_module,