fix: xformers
This commit is contained in:
parent
685f9631b5
commit
35e1017e3e
2 changed files with 19 additions and 0 deletions
18
modules/import_hook.py
Normal file
18
modules/import_hook.py
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
import builtins
|
||||||
|
import sys
|
||||||
|
|
||||||
|
old_import = builtins.__import__
|
||||||
|
IMPORT_BLACKLIST = []
|
||||||
|
|
||||||
|
|
||||||
|
if "xformers" not in "".join(sys.argv):
|
||||||
|
IMPORT_BLACKLIST.append("xformers")
|
||||||
|
|
||||||
|
|
||||||
|
def import_hook(*args, **kwargs):
|
||||||
|
if args[0] in IMPORT_BLACKLIST:
|
||||||
|
raise ImportError("Import of %s is blacklisted" % args[0])
|
||||||
|
return old_import(*args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
builtins.__import__ = import_hook
|
1
webui.py
1
webui.py
|
@ -8,6 +8,7 @@ from fastapi import FastAPI
|
||||||
from fastapi.middleware.cors import CORSMiddleware
|
from fastapi.middleware.cors import CORSMiddleware
|
||||||
from fastapi.middleware.gzip import GZipMiddleware
|
from fastapi.middleware.gzip import GZipMiddleware
|
||||||
|
|
||||||
|
from modules import import_hook
|
||||||
from modules.call_queue import wrap_queued_call, queue_lock, wrap_gradio_gpu_call
|
from modules.call_queue import wrap_queued_call, queue_lock, wrap_gradio_gpu_call
|
||||||
from modules.paths import script_path
|
from modules.paths import script_path
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue