Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
automatic1111
GitHub Repository: automatic1111/stable-diffusion-webui
Path: blob/master/modules/import_hook.py
3055 views
1
import sys
2
3
# this will break any attempt to import xformers which will prevent stability diffusion repo from trying to use it
4
if "--xformers" not in "".join(sys.argv):
5
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
try:
13
import torchvision.transforms.functional as functional
14
sys.modules["torchvision.transforms.functional_tensor"] = functional
15
except ImportError:
16
pass # shrug...
17
18