diff options
author | Kohaku-Blueleaf <59680068+KohakuBlueleaf@users.noreply.github.com> | 2023-12-04 08:47:41 +0000 |
---|---|---|
committer | Kohaku-Blueleaf <59680068+KohakuBlueleaf@users.noreply.github.com> | 2023-12-04 08:47:41 +0000 |
commit | f5f89780ccf637979c0c88546080a13afd61c9a3 (patch) | |
tree | 4ba683c9d8884193960b1dbe74809bf6c77e23c2 /modules/import_hook.py | |
parent | 9a15ae2a92e55d614fe515cd0a104d90b854b23f (diff) | |
parent | 48fae7ccdc2fe2d2ba8e8cfcb17b56028734e570 (diff) | |
download | stable-diffusion-webui-gfx803-f5f89780ccf637979c0c88546080a13afd61c9a3.tar.gz stable-diffusion-webui-gfx803-f5f89780ccf637979c0c88546080a13afd61c9a3.tar.bz2 stable-diffusion-webui-gfx803-f5f89780ccf637979c0c88546080a13afd61c9a3.zip |
Merge branch 'dev' into test-fp8
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... |