aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAUTOMATIC <16777216c@gmail.com>2022-09-17 09:23:31 +0300
committerAUTOMATIC <16777216c@gmail.com>2022-09-17 09:23:31 +0300
commitb8be33dad13d4937c6ef8fbb49715d843c3dd586 (patch)
treeccbc18bd8c9b117e159f1c16842e3655b30b4fd2
parented6787ca2fe950f633a925ccb0467eafd4ec0f43 (diff)
hide VRAM text if polling is disabled
-rw-r--r--modules/ui.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/modules/ui.py b/modules/ui.py
index 01b2ba85..437bce66 100644
--- a/modules/ui.py
+++ b/modules/ui.py
@@ -136,7 +136,7 @@ def wrap_gradio_call(func):
elapsed = time.perf_counter() - t
- 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']
reserved_peak = mem_stats['reserved_peak']
sys_peak = '?' if opts.memmon_poll_rate <= 0 else mem_stats['system_peak']
@@ -146,9 +146,10 @@ def wrap_gradio_call(func):
"Torch reserved: Peak amount of VRAM allocated by Torch, including all active and cached data.&#013;" \
"Sys VRAM: Peak amount of VRAM allocation across all applications / total GPU VRAM (peak utilization%)."
+ vram_html = '' if opts.memmon_poll_rate == 0 else f"<p class='vram' title='{vram_tooltip}'>Torch active/reserved: {active_peak}/{reserved_peak} MiB, <wbr>Sys VRAM: {sys_peak}/{sys_total} MiB ({sys_pct}%)</p>"
+
# last item is always HTML
- res[-1] += f"<div class='performance'><p class='time'>Time taken: <wbr>{elapsed:.2f}s</p>" \
- f"<p class='vram' title='{vram_tooltip}'>Torch active/reserved: {active_peak}/{reserved_peak} MiB, <wbr>Sys VRAM: {sys_peak}/{sys_total} MiB ({sys_pct}%)</p></div>"
+ res[-1] += f"<div class='performance'><p class='time'>Time taken: <wbr>{elapsed:.2f}s</p>{vram_html}</div>"
shared.state.interrupted = False