aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKohaku-Blueleaf <59680068+KohakuBlueleaf@users.noreply.github.com>2024-01-20 08:33:59 +0000
committerKohaku-Blueleaf <59680068+KohakuBlueleaf@users.noreply.github.com>2024-01-20 08:33:59 +0000
commit4a66d2fb228584bb38dc22db6a3e657561834c7a (patch)
treee9b0f661e386f07f47714d0bbd0e419ca40aec2a
parent81126027f5226e7ee58e1a99194eb9ec7b8ec6e7 (diff)
downloadstable-diffusion-webui-gfx803-4a66d2fb228584bb38dc22db6a3e657561834c7a.tar.gz
stable-diffusion-webui-gfx803-4a66d2fb228584bb38dc22db6a3e657561834c7a.tar.bz2
stable-diffusion-webui-gfx803-4a66d2fb228584bb38dc22db6a3e657561834c7a.zip
Avoid exceptions to be silenced
-rw-r--r--modules/devices.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/modules/devices.py b/modules/devices.py
index 3bde1699..dfffaf24 100644
--- a/modules/devices.py
+++ b/modules/devices.py
@@ -178,12 +178,11 @@ def manual_cast(target_dtype):
try:
yield None
finally:
- if not applied:
- return
- for module_type in patch_module_list:
- if hasattr(module_type, "org_forward"):
- module_type.forward = module_type.org_forward
- delattr(module_type, "org_forward")
+ if applied:
+ for module_type in patch_module_list:
+ if hasattr(module_type, "org_forward"):
+ module_type.forward = module_type.org_forward
+ delattr(module_type, "org_forward")
def autocast(disable=False):