diff options
author | hako-mikan <122196982+hako-mikan@users.noreply.github.com> | 2024-02-09 14:17:40 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-09 14:17:40 +0000 |
commit | 0bc7867ccd4ac24f5f270cb767c4642d0a0c001c (patch) | |
tree | 2ad13a0cf77bc189a8c9097bd507f9674f993da6 /modules/import_hook.py | |
parent | 816096e642187a18b11e2729c42c0b5f677f047d (diff) | |
parent | cf2772fab0af5573da775e7437e6acdca424f26e (diff) | |
download | stable-diffusion-webui-gfx803-0bc7867ccd4ac24f5f270cb767c4642d0a0c001c.tar.gz stable-diffusion-webui-gfx803-0bc7867ccd4ac24f5f270cb767c4642d0a0c001c.tar.bz2 stable-diffusion-webui-gfx803-0bc7867ccd4ac24f5f270cb767c4642d0a0c001c.zip |
Merge branch 'AUTOMATIC1111:master' into master
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... |