Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Studio: report the LTX-2.5 encoder worker host memory on macOS and Windows too (#17014)
Daniel Han66b60620fca0
diff --git a/studio/backend/core/inference/video_ltx25_te_worker.py b/studio/backend/core/inference/video_ltx25_te_worker.pyindex 33307efa980..3d36ac610de 100644--- a/studio/backend/core/inference/video_ltx25_te_worker.py+++ b/studio/backend/core/inference/video_ltx25_te_worker.py@@ -772,12 +772,27 @@ def _memory_stats(device: str) -> dict:torch.cuda.reset_peak_memory_stats(dev)except Exception: # noqa: BLE001 -- stats are best-effortpass+ try:+ import psutil++ info = psutil.Process().memory_info()+ stats["host_rss_mib"] = info.rss >> 20+ if getattr(info, "peak_wset", None): # Windows has no getrusage+ stats["host_peak_rss_mib"] = info.peak_wset >> 20+ except Exception: # noqa: BLE001 -- stats are best-effort+ passtry:import resource- stats["host_peak_rss_mib"] = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss >> 10- with open("/proc/self/statm", encoding = "ascii") as fh:- stats["host_rss_mib"] = (int(fh.read().split()[1]) * os.sysconf("SC_PAGE_SIZE")) >> 20- except Exception: # noqa: BLE001 -- not Linux++ # ru_maxrss is KiB on Linux but bytes on macOS.+ peak = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss+ stats["host_peak_rss_mib"] = peak >> (20 if sys.platform == "darwin" else 10)+ if "host_rss_mib" not in stats:+ with open("/proc/self/statm", encoding = "ascii") as fh:+ stats["host_rss_mib"] = (+ int(fh.read().split()[1]) * os.sysconf("SC_PAGE_SIZE")+ ) >> 20+ except Exception: # noqa: BLE001 -- Windows, or no /procpassreturn statsdiff --git a/studio/backend/tests/test_video_ltx25.py b/studio/backend/tests/test_video_ltx25.pyindex 2e9767b8c1f..cf0cf638ac4 100644--- a/studio/backend/tests/test_video_ltx25.py+++ b/studio/backend/tests/test_video_ltx25.py@@ -2138,6 +2138,45 @@ def test_worker_reports_its_own_memory():assert stats.get("host_rss_mib", 0) > 0 and "gpu_peak_allocated_mib" not in stats+ "platform, maxrss, has_proc",+ [("linux", 600 << 10, True), ("darwin", 600 << 20, False), ("win32", None, False)],+)+def test_worker_memory_stats_are_mib_on_every_platform(platform, maxrss, has_proc, monkeypatch):+ """getrusage's ru_maxrss is KiB on Linux and bytes on macOS; Windows has neither it nor /proc."""+ import builtins+ import sys as real_sys++ import psutil++ from core.inference import video_ltx25_te_worker as worker++ class _Info:+ rss = 300 << 20+ peak_wset = 700 << 20 if platform == "win32" else None++ monkeypatch.setattr(psutil, "Process", lambda: SimpleNamespace(memory_info = lambda: _Info()))+ monkeypatch.setattr(real_sys, "platform", platform)+ # A stand-in module either way, so the test runs on Windows, which has no `resource`.+ fake = (+ None+ if maxrss is None+ else SimpleNamespace(RUSAGE_SELF = 0, getrusage = lambda who: SimpleNamespace(ru_maxrss = maxrss))+ )+ monkeypatch.setitem(real_sys.modules, "resource", fake)+ real_open = builtins.open++ def _open(path, *a, **k):+ if str(path) == "/proc/self/statm" and not has_proc:+ raise FileNotFoundError(path)+ return real_open(path, *a, **k)++ monkeypatch.setattr(builtins, "open", _open)+ stats = worker._memory_stats("cpu")+ assert stats["host_rss_mib"] == 300+ assert stats["host_peak_rss_mib"] == (700 if platform == "win32" else 600)++class _Planned(Exception):pass