reset memory stats between runs

Signed-off-by: Vladimir Mandic <mandic00@live.com>
This commit is contained in:
Vladimir Mandic
2025-04-01 14:00:39 -04:00
parent bd304b59b7
commit 17fbadb0e8
3 changed files with 10 additions and 1 deletions
+7
View File
@@ -74,6 +74,13 @@ def memory_stats():
return mem
def reset_stats():
try:
torch.cuda.reset_memory_stats()
except Exception:
pass
def memory_cache():
return mem
+1
View File
@@ -81,6 +81,7 @@ class Processed:
self.all_seeds = all_seeds or p.all_seeds or [self.seed]
self.all_subseeds = all_subseeds or p.all_subseeds or [self.subseed]
self.infotexts = infotexts or [self.info]
memstats.reset_stats()
def js(self):
obj = {
+2 -1
View File
@@ -1056,8 +1056,9 @@ def clear_caches():
lora_common.loaded_networks.clear()
lora_common.previously_loaded_networks.clear()
lora_load.lora_cache.clear()
from modules import prompt_parser_diffusers
from modules import prompt_parser_diffusers, memstats
prompt_parser_diffusers.cache.clear()
memstats.reset_stats()
def unload_model_weights(op='model'):