From 8be7b347aa1349daa4b93d0f3be804129427c51b Mon Sep 17 00:00:00 2001 From: lllyasviel Date: Sat, 3 Feb 2024 23:03:21 -0800 Subject: [PATCH] Update unet_patcher.py --- modules_forge/unet_patcher.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules_forge/unet_patcher.py b/modules_forge/unet_patcher.py index e750e86a..df40d7aa 100644 --- a/modules_forge/unet_patcher.py +++ b/modules_forge/unet_patcher.py @@ -112,13 +112,15 @@ class UnetPatcher(ModelPatcher): class ExampleScript(scripts.Script): def process_batch(self, p, *args, **kwargs): - unet = p.sd_model.forge_objects.unet + unet = p.sd_model.forge_objects.unet.clone() def modifier(x): return x ** 0.5 unet.add_alphas_cumprod_modifier(modifier) - return + p.sd_model.forge_objects.unet = unet + + return This add_alphas_cumprod_modifier is the only patch option that should be used in process_batch() All other patch options should be called in process_before_every_sampling()