diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2023-12-16 10:05:10 +0300 |
---|---|---|
committer | AUTOMATIC1111 <16777216c@gmail.com> | 2023-12-16 10:05:10 +0300 |
commit | e9c6325fc635302e2b4b8295345833cb8b15f7fb (patch) | |
tree | b501070bcf1ae667b1555e682598973818c945e0 /modules/import_hook.py | |
parent | 29f04149b60bcf6e8e2b41a161d6cc7e8981710f (diff) | |
parent | 7504f14503d6ce5a014f1c558ea4f4d57675e1e9 (diff) |
Merge branch 'dev' into torch210
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... |