mirror of
https://github.com/vladmandic/automatic
synced 2026-09-20 01:31:13 +02:00
@@ -2,7 +2,7 @@ import html
|
||||
import threading
|
||||
import time
|
||||
import cProfile
|
||||
from modules import shared, progress, errors
|
||||
from modules import shared, progress, errors, timer
|
||||
|
||||
queue_lock = threading.Lock()
|
||||
|
||||
@@ -73,15 +73,16 @@ def wrap_gradio_call(func, extra_outputs=None, add_stats=False, name=None):
|
||||
elapsed_m = int(elapsed // 60)
|
||||
elapsed_s = elapsed % 60
|
||||
elapsed_text = f"{elapsed_m}m {elapsed_s:.2f}s" if elapsed_m > 0 else f"{elapsed_s:.2f}s"
|
||||
summary = timer.process.summary(min_time=0.1, total=False).replace('=', ' ')
|
||||
vram_html = ''
|
||||
if not shared.mem_mon.disabled:
|
||||
vram = {k: -(v//-(1024*1024)) for k, v in shared.mem_mon.read().items()}
|
||||
used = round(100 * vram['used'] / (vram['total'] + 0.001))
|
||||
if vram.get('active_peak', 0) > 0:
|
||||
vram_html = " | <p class='vram'>"
|
||||
vram_html += f"GPU active {max(vram['active_peak'], vram['reserved_peak'])} MB reserved {vram['reserved']} | used {vram['used']} MB free {vram['free']} MB total {vram['total']} MB"
|
||||
vram_html = " | "
|
||||
vram_html += f"GPU {max(vram['active_peak'], vram['reserved_peak'])} MB {used}%"
|
||||
vram_html += f" | retries {vram['retries']} oom {vram['oom']}" if vram.get('retries', 0) > 0 or vram.get('oom', 0) > 0 else ''
|
||||
vram_html += "</p>"
|
||||
if isinstance(res, list):
|
||||
res[-1] += f"<div class='performance'><p class='time'>Time: {elapsed_text}</p>{vram_html}</div>"
|
||||
res[-1] += f"<div class='performance'><p>Time: {elapsed_text} | {summary}{vram_html}</p></div>"
|
||||
return tuple(res)
|
||||
return f
|
||||
|
||||
Reference in New Issue
Block a user