Skip to content
Merged

Dev #3815

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# Change Log for SD.Next

## Update for 2025-03-11
## Update for 2025-03-12

- fix installer not starting when older version of rich is installed
- fix circular imports when debug flags are enabled
- fix cuda errors with directml
- fix memory stats not displaying the ram usage
- **ipex**
- add xpu to profiler
- fix untyped_storage, torch.eye and torch.cuda.device ops
Expand Down
13 changes: 8 additions & 5 deletions modules/call_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,18 @@ def f(*args, extra_outputs_array=extra_outputs, **kwargs):
gpu = ''
cpu = ''
if not shared.mem_mon.disabled:
vram = {k: -(v//-(1024*1024)) for k, v in shared.mem_mon.read().items()}
mem_mon_read = shared.mem_mon.read()
ooms = mem_mon_read.pop("oom")
retries = mem_mon_read.pop("retries")
vram = {k: v//1048576 for k, v in mem_mon_read.items()}
peak = max(vram['active_peak'], vram['reserved_peak'], vram['used'])
used = round(100.0 * peak / vram['total']) if vram['total'] > 0 else 0
if used > 0:
gpu += f"| GPU {peak} MB {used}%"
gpu += f" | retries {vram['retries']} oom {vram['oom']}" if vram.get('retries', 0) > 0 or vram.get('oom', 0) > 0 else ''
ram = shared.ram_stats()
if ram['used'] > 0:
cpu += f"| RAM {ram['used']} GB {round(100.0 * ram['used'] / ram['total'])}%"
gpu += f" | retries {retries} oom {ooms}" if retries > 0 or ooms > 0 else ''
ram = shared.ram_stats()
if ram['used'] > 0:
cpu += f"| RAM {ram['used']} GB {round(100.0 * ram['used'] / ram['total'])}%"
if isinstance(res, list):
res[-1] += f"<div class='performance'><p>Time: {elapsed_text} | {summary} {gpu} {cpu}</p></div>"
return tuple(res)
Expand Down
8 changes: 4 additions & 4 deletions modules/memmon.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ def read(self):
self.data["free"], self.data["total"] = torch.cuda.mem_get_info(self.device.index if self.device.index is not None else torch.cuda.current_device())
self.data["used"] = self.data["total"] - self.data["free"]
torch_stats = torch.cuda.memory_stats(self.device)
self.data["active"] = torch_stats.get("active.all.current", torch_stats["active_bytes.all.current"])
self.data["active_peak"] = torch_stats["active_bytes.all.peak"]
self.data["reserved"] = torch_stats["reserved_bytes.all.current"]
self.data["reserved_peak"] = torch_stats["reserved_bytes.all.peak"]
self.data["active"] = torch_stats.get("active.all.current", torch_stats.get("active_bytes.all.current", -1))
self.data["active_peak"] = torch_stats.get("active_bytes.all.peak", -1)
self.data["reserved"] = torch_stats.get("reserved_bytes.all.current", -1)
self.data["reserved_peak"] = torch_stats.get("reserved_bytes.all.peak", -1)
self.data['retries'] = torch_stats.get("num_alloc_retries", -1)
self.data['oom'] = torch_stats.get("num_ooms", -1)
except Exception:
Expand Down
2 changes: 1 addition & 1 deletion modules/memstats.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def ram_stats():
process = psutil.Process(os.getpid())
res = process.memory_info()
ram_total = 100 * res.rss / process.memory_percent()
ram_total = min(ram_total, docker_limit(), runpod_limit())
ram_total = min(ram_total, get_docker_limit(), get_runpod_limit())
ram = { 'used': gb(res.rss), 'total': gb(ram_total) }
return ram
except Exception:
Expand Down