aboutsummaryrefslogtreecommitdiffstats
path: root/modules/import_hook.py
diff options
context:
space:
mode:
authorCodeHatchling <steve@codehatch.com>2023-12-05 03:38:13 +0000
committerCodeHatchling <steve@codehatch.com>2023-12-05 03:38:13 +0000
commit38864816fa8c83d079a49f94674ca3dede9dcaad (patch)
treedfd1b97ad7c5c66ffc5c8641c6e7cc635441e82b /modules/import_hook.py
parent49bbf1140731036875573bb7c44aa7e74623c856 (diff)
parent22e23dbf29b0bbc807daa57318c31145f8dd0774 (diff)
downloadstable-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/import_hook.py')
-rw-r--r--modules/import_hook.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/modules/import_hook.py b/modules/import_hook.py
index 28c67dfa..eba9a372 100644
--- a/modules/import_hook.py
+++ b/modules/import_hook.py
@@ -3,3 +3,14 @@ import sys
# this will break any attempt to import xformers which will prevent stability diffusion repo from trying to use it
if "--xformers" not in "".join(sys.argv):
sys.modules["xformers"] = None
+
+# Hack to fix a changed import in torchvision 0.17+, which otherwise breaks
+# basicsr; see https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/13985
+try:
+ import torchvision.transforms.functional_tensor # noqa: F401
+except ImportError:
+ try:
+ import torchvision.transforms.functional as functional
+ sys.modules["torchvision.transforms.functional_tensor"] = functional
+ except ImportError:
+ pass # shrug...