diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2023-12-16 06:58:07 +0000 |
---|---|---|
committer | AUTOMATIC1111 <16777216c@gmail.com> | 2023-12-16 06:58:07 +0000 |
commit | cf2772fab0af5573da775e7437e6acdca424f26e (patch) | |
tree | 2ad13a0cf77bc189a8c9097bd507f9674f993da6 /modules/import_hook.py | |
parent | 4afaaf8a020c1df457bcf7250cb1c7f609699fa7 (diff) | |
parent | 0dfffe53ec11b2ee097d55efc479f8e707015db9 (diff) | |
download | stable-diffusion-webui-gfx803-cf2772fab0af5573da775e7437e6acdca424f26e.tar.gz stable-diffusion-webui-gfx803-cf2772fab0af5573da775e7437e6acdca424f26e.tar.bz2 stable-diffusion-webui-gfx803-cf2772fab0af5573da775e7437e6acdca424f26e.zip |
Merge branch 'release_candidate'
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... |