Commit 46db1405 authored by EyeDeck's avatar EyeDeck

...and make sure it can't get stuck on

in case someone sets opts.memmon_poll_rate to 0 during generation
parent fabaf4bd
...@@ -119,7 +119,8 @@ def save_files(js_data, images, index): ...@@ -119,7 +119,8 @@ def save_files(js_data, images, index):
def wrap_gradio_call(func): def wrap_gradio_call(func):
def f(*args, **kwargs): def f(*args, **kwargs):
if opts.memmon_poll_rate > 0 and not shared.mem_mon.disabled: run_memmon = opts.memmon_poll_rate > 0 and not shared.mem_mon.disabled
if run_memmon:
shared.mem_mon.monitor() shared.mem_mon.monitor()
t = time.perf_counter() t = time.perf_counter()
...@@ -137,7 +138,7 @@ def wrap_gradio_call(func): ...@@ -137,7 +138,7 @@ def wrap_gradio_call(func):
elapsed = time.perf_counter() - t elapsed = time.perf_counter() - t
if opts.memmon_poll_rate > 0 and not shared.mem_mon.disabled: if run_memmon:
mem_stats = {k: -(v//-(1024*1024)) for k, v in shared.mem_mon.stop().items()} mem_stats = {k: -(v//-(1024*1024)) for k, v in shared.mem_mon.stop().items()}
active_peak = mem_stats['active_peak'] active_peak = mem_stats['active_peak']
reserved_peak = mem_stats['reserved_peak'] reserved_peak = mem_stats['reserved_peak']
......
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