Unverified Commit 13e0295a authored by Akiba's avatar Akiba

fix: xformers use importlib

parent 35e1017e
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
sys.modules["xformers"] = None
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment