From 308c96d13c2dfbd0d5b79f619ce7d97fdd218efd Mon Sep 17 00:00:00 2001 From: takahiro-nihei <66118290+nihedon@users.noreply.github.com> Date: Sat, 5 Oct 2024 12:29:41 +0900 Subject: [PATCH] Fixed bug where LoRA stopped working when HiRes was enabled. --- scripts/lora_block_weight.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/lora_block_weight.py b/scripts/lora_block_weight.py index b67aaf6..eb7a46c 100644 --- a/scripts/lora_block_weight.py +++ b/scripts/lora_block_weight.py @@ -4,6 +4,7 @@ import os import gc import re import sys +import copy import torch import shutil import math @@ -1143,6 +1144,7 @@ def lbw(lora,lwei,elemental): LORAS = ["lora", "loha", "lokr"] def lbwf(after_applying_lora_patches, ms, lwei, elements, starts, func_ratio): + after_applying_lora_patches = copy.deepcopy(after_applying_lora_patches) errormodules = [] dict_lora_patches = dict(after_applying_lora_patches.items()) for m, l, e, s, hash in zip(ms, lwei, elements, starts, list(shared.sd_model.forge_objects.unet.lora_patches.keys())):