diff options
author | CodeHatchling <steve@codehatch.com> | 2023-12-05 03:38:13 +0000 |
---|---|---|
committer | CodeHatchling <steve@codehatch.com> | 2023-12-05 03:38:13 +0000 |
commit | 38864816fa8c83d079a49f94674ca3dede9dcaad (patch) | |
tree | dfd1b97ad7c5c66ffc5c8641c6e7cc635441e82b /modules/sd_unet.py | |
parent | 49bbf1140731036875573bb7c44aa7e74623c856 (diff) | |
parent | 22e23dbf29b0bbc807daa57318c31145f8dd0774 (diff) | |
download | stable-diffusion-webui-gfx803-38864816fa8c83d079a49f94674ca3dede9dcaad.tar.gz stable-diffusion-webui-gfx803-38864816fa8c83d079a49f94674ca3dede9dcaad.tar.bz2 stable-diffusion-webui-gfx803-38864816fa8c83d079a49f94674ca3dede9dcaad.zip |
Merge remote-tracking branch 'origin2/dev' into soft-inpainting
# Conflicts:
# modules/processing.py
Diffstat (limited to 'modules/sd_unet.py')
-rw-r--r-- | modules/sd_unet.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/modules/sd_unet.py b/modules/sd_unet.py index 6a7bc9e2..a771849c 100644 --- a/modules/sd_unet.py +++ b/modules/sd_unet.py @@ -5,8 +5,7 @@ from modules import script_callbacks, shared, devices unet_options = []
current_unet_option = None
current_unet = None
-original_forward = None
-
+original_forward = None # not used, only left temporarily for compatibility
def list_unets():
new_unets = script_callbacks.list_unets_callback()
@@ -84,9 +83,12 @@ class SdUnet(torch.nn.Module): pass
-def UNetModel_forward(self, x, timesteps=None, context=None, *args, **kwargs):
- if current_unet is not None:
- return current_unet.forward(x, timesteps, context, *args, **kwargs)
+def create_unet_forward(original_forward):
+ def UNetModel_forward(self, x, timesteps=None, context=None, *args, **kwargs):
+ if current_unet is not None:
+ return current_unet.forward(x, timesteps, context, *args, **kwargs)
+
+ return original_forward(self, x, timesteps, context, *args, **kwargs)
- return original_forward(self, x, timesteps, context, *args, **kwargs)
+ return UNetModel_forward
|