Skip to content

Commit 5120d06

Browse files
committed
Add import_hook hack to work around basicsr incompatibility
Fixes #13985
1 parent b4776ea commit 5120d06

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

modules/import_hook.py

+8
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,11 @@
33
# this will break any attempt to import xformers which will prevent stability diffusion repo from trying to use it
44
if "--xformers" not in "".join(sys.argv):
55
sys.modules["xformers"] = None
6+
7+
# Hack to fix a changed import in torchvision 0.17+, which otherwise breaks
8+
# basicsr; see https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/13985
9+
try:
10+
import torchvision.transforms.functional_tensor # noqa: F401
11+
except ImportError:
12+
import torchvision.transforms.functional as functional
13+
sys.modules["torchvision.transforms.functional_tensor"] = functional

0 commit comments

Comments
 (0)