Upload 2 files
Browse files
mod.py
CHANGED
@@ -74,10 +74,13 @@ def is_repo_exists(repo_id):
|
|
74 |
|
75 |
|
76 |
def clear_cache():
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
|
|
|
|
|
|
81 |
|
82 |
|
83 |
def deselect_lora():
|
@@ -348,3 +351,4 @@ load_prompt_enhancer.zerogpu = True
|
|
348 |
fuse_loras.zerogpu = True
|
349 |
preprocess_image.zerogpu = True
|
350 |
get_control_params.zerogpu = True
|
|
|
|
74 |
|
75 |
|
76 |
def clear_cache():
|
77 |
+
try:
|
78 |
+
torch.cuda.empty_cache()
|
79 |
+
torch.cuda.reset_max_memory_allocated()
|
80 |
+
torch.cuda.reset_peak_memory_stats()
|
81 |
+
gc.collect()
|
82 |
+
except Exception as e:
|
83 |
+
print(e)
|
84 |
|
85 |
|
86 |
def deselect_lora():
|
|
|
351 |
fuse_loras.zerogpu = True
|
352 |
preprocess_image.zerogpu = True
|
353 |
get_control_params.zerogpu = True
|
354 |
+
clear_cache.zerogpu = True
|