Skip to content

Commit 44ff9c2

Browse files
committed
Update import_hook.py
1 parent c095729 commit 44ff9c2

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

‎modules/import_hook.py‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,15 @@
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+
8+
# Hack to fix a changed import in torchvision 0.17+, which otherwise breaks
9+
# basicsr; see https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/13985
10+
try:
11+
import torchvision.transforms.functional_tensor # noqa: F401
12+
except ImportError:
13+
try:
14+
import torchvision.transforms.functional as functional
15+
sys.modules["torchvision.transforms.functional_tensor"] = functional
16+
except ImportError:
17+
pass

0 commit comments

Comments
 (0)