From 13e0295ab682299e3280eb6ff28be0870f2bc57c Mon Sep 17 00:00:00 2001
From: Akiba <akiba@anzu.link>
Date: Sat, 24 Dec 2022 11:17:21 +0800
Subject: [PATCH] fix: xformers use importlib

---
 modules/import_hook.py | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)

diff --git a/modules/import_hook.py b/modules/import_hook.py
index eb10e4fde..7403135d7 100644
--- a/modules/import_hook.py
+++ b/modules/import_hook.py
@@ -1,18 +1,5 @@
-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