diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2024-01-01 14:01:06 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-01 14:01:06 +0000 |
commit | 7ba02e0b7cfc85d5d237eba71ab4d66564857d55 (patch) | |
tree | b317227a0e63c42aa8c4b06147761dfd37ae24fc /modules/import_hook.py | |
parent | be31e7e71a08dc27543d31aa6e6532463ccbf20f (diff) | |
parent | 15156cde18844f459ba101b1356d162aa7f39c47 (diff) | |
download | stable-diffusion-webui-gfx803-7ba02e0b7cfc85d5d237eba71ab4d66564857d55.tar.gz stable-diffusion-webui-gfx803-7ba02e0b7cfc85d5d237eba71ab4d66564857d55.tar.bz2 stable-diffusion-webui-gfx803-7ba02e0b7cfc85d5d237eba71ab4d66564857d55.zip |
Merge branch 'dev' into finer-settings-freezing-control
Diffstat (limited to 'modules/import_hook.py')
-rw-r--r-- | modules/import_hook.py | 11 |
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... |