unload xformers when not used

This commit is contained in:
Vladimir Mandic
2023-04-18 07:47:41 -04:00
parent d69738cc07
commit 86783d164c
7 changed files with 59 additions and 13 deletions
+3 -1
View File
@@ -1,3 +1,4 @@
import sys
import html
import threading
import time
@@ -51,7 +52,8 @@ def wrap_gradio_call(func, extra_outputs=None, add_stats=False):
if run_memmon:
shared.mem_mon.monitor()
t = time.perf_counter()
if sys.modules['xformers'] is not None and shared.opts.cross_attention_optimization != "xFormers":
sys.modules["xformers"] = None
try:
if shared.cmd_opts.profile:
pr = cProfile.Profile()