Skip to content

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.

Studio: Live monitor with CPU, memory and per-GPU rows, Unsloth's share by model, and a refresh rate (#15630)

Leo Borcherding5e0918863aa8
diff --git a/studio/backend/core/inference/gpu_residency.py b/studio/backend/core/inference/gpu_residency.py
index 7577edc874a..5ec13d613a8 100644
--- a/studio/backend/core/inference/gpu_residency.py
+++ b/studio/backend/core/inference/gpu_residency.py
@@ -95,10 +95,17 @@ def media_held_mib() -> dict[int, int]:
def media_owner_held_mib(owner: str) -> Optional[int]:
- """MiB admitted for one resident media owner across its GPUs, or None when unpriced. Never raises."""
+ """MiB one resident media owner holds across its GPUs: its admitted need less the generation headroom
+ it is not using while idle (as media_unallocated_mib counts it). None when unpriced or loading. Never raises."""
try:
need = _media_records().get(owner)
- total = sum(int(mib) for mib in need.values()) if need else 0
+ if not need:
+ return None
+ loading, generating = _media_busy(owner)
+ if loading:
+ return None
+ headroom = 0 if generating else int(getattr(need, "headroom_mib", 0))
+ total = sum(max(0, int(mib) - headroom) for mib in need.values())
return total or None
except Exception: # noqa: BLE001
return None
diff --git a/studio/backend/core/inference/model_slots.py b/studio/backend/core/inference/model_slots.py
index 05a47e61860..a78cd3e1913 100644
--- a/studio/backend/core/inference/model_slots.py
+++ b/studio/backend/core/inference/model_slots.py
@@ -109,8 +109,13 @@ def serving_slot(requested: str, candidates: list[ExtraSlot], satisfies) -> Opti
return None
-async def route(requested: Optional[str], satisfies) -> Optional[ExtraSlot]:
- """Route this task to the slot serving ``requested``, if any, and hold it until the task ends."""
+async def route(
+ requested: Optional[str],
+ satisfies,
+ touch: bool = True,
+) -> Optional[ExtraSlot]:
+ """Route this task to the slot serving ``requested``, if any, and hold it until the task ends.
+ ``touch=False`` for reads (status polls), which must not reorder eviction."""
routed_slot.set(None)
if not (slots and isinstance(requested, str) and requested):
return None
@@ -121,7 +126,8 @@ async def route(requested: Optional[str], satisfies) -> Optional[ExtraSlot]:
if slot is None or not reserve(slot):
return None
routed_slot.set(slot)
- slot.last_used = time.monotonic()
+ if touch:
+ slot.last_used = time.monotonic()
return slot
diff --git a/studio/backend/main.py b/studio/backend/main.py
index 0df1c55cd96..9f4948aa803 100644
--- a/studio/backend/main.py
+++ b/studio/backend/main.py
@@ -61,6 +61,7 @@ if sys.platform == "win32":
_SYSTEM_GPU_CACHE_TTL_SECONDS = 10.0
_system_gpu_cache_lock = threading.Lock()
_system_gpu_cache: Optional[tuple[float, tuple[dict[str, Any], dict[str, Any]]]] = None
+_system_gpu_probe_s = 0.0
_CPU_PERCENT_MIN_WINDOW_S = 1.0
_cpu_percent_lock = threading.Lock()
@@ -100,6 +101,48 @@ def _cpu_usage_percent() -> float:
_prime_cpu_percent()
+_PACKAGE_VERSIONS_TTL_S = 60.0
+_package_versions_cache: Optional[tuple] = None
+
+
+def _ml_package_versions(read: Any, not_found: type) -> dict:
+ global _package_versions_cache
+ now = time.monotonic()
+ cached = _package_versions_cache
+ if cached is not None and cached[1] is read and now - cached[0] < _PACKAGE_VERSIONS_TTL_S:
+ return dict(cached[2])
+ packages = {}
+ for pkg in ("torch", "transformers", "mlx_lm", "mlx_vlm"):
+ try:
+ packages[pkg] = read(pkg)
+ except not_found:
+ pass
+ except Exception as e:
+ logger.debug(f"Failed to read {pkg} version: {e}")
+ _package_versions_cache = (now, read, packages)
+ return dict(packages)
+
+
+# Off Linux psutil scans every process to find children; reuse the set briefly.
+_DESCENDANTS_TTL_S = 5.0
+_descendants_cache: dict = {}
+
+
+def _cached_descendants(process: Any) -> list:
+ import psutil
+
+ if not isinstance(process, psutil.Process):
+ return process.children(recursive = True)
+ now = time.monotonic()
+ cached = _descendants_cache.get(process.pid)
+ if cached is not None and now - cached[0] < _DESCENDANTS_TTL_S:
+ return cached[1]
+ children = process.children(recursive = True)
+ _descendants_cache.clear()
+ _descendants_cache[process.pid] = (now, children)
+ return children
+
+
def _process_tree_rss_mb(process: Any) -> int:
"""RSS of this process and its children (llama-server, the training worker), best effort."""
import psutil
@@ -121,7 +164,7 @@ def _process_tree_rss_mb(process: Any) -> int:
continue
if children is None:
try:
- children = process.children(recursive = True)
+ children = _cached_descendants(process)
except (psutil.NoSuchProcess, psutil.AccessDenied):
children = []
for child in children:
@@ -2541,8 +2584,52 @@ def _schedule_shutdown(request: Request) -> dict:
return {"status": "shutting_down"}
+_SYSTEM_GPU_MIN_AGE_SECONDS = 1.0
+# Slow probes (about 1.5 s on Windows ROCm) space fast polls out.
+_SYSTEM_GPU_PROBE_SPACING = 4.0
+
+
+def _system_gpu_max_age_s(requested: Optional[float]) -> float:
+ if requested is None or not isinstance(requested, (int, float)) or requested != requested:
+ return _SYSTEM_GPU_CACHE_TTL_SECONDS
+ return min(_SYSTEM_GPU_CACHE_TTL_SECONDS, max(_SYSTEM_GPU_MIN_AGE_SECONDS, float(requested)))
+
+
+_gguf_pin_support_cache: Optional[tuple[float, tuple[bool, bool]]] = None
+
+
+def _gguf_pin_support(logger, refresh: bool = False) -> tuple[bool, bool]:
+ """(llama.cpp uses Vulkan, gpu_ids can be pinned)."""
+ global _gguf_pin_support_cache
+ now = time.monotonic()
+ cached = _gguf_pin_support_cache
+ if not refresh and cached is not None and now - cached[0] < _SYSTEM_GPU_CACHE_TTL_SECONDS:
+ return cached[1]
+ try:
+ from core.inference.llama_cpp import LlamaCppBackend
+ from utils.hardware import DeviceType, get_device
+
+ llama_uses_vulkan = LlamaCppBackend._is_vulkan_backend()
+ if llama_uses_vulkan:
+ # Vulkan ordinals live in another namespace; a failed probe must not expose torch indices.
+ gpu_ids_supported = False
+ else:
+ # XPU pins are unsafe across Level Zero FLAT/COMPOSITE; CPU-only llama.cpp cannot pin.
+ gpu_ids_supported = (
+ get_device() != DeviceType.XPU and not LlamaCppBackend._backend_lacks_gpu_lib()
+ )
+ except Exception as e:
+ logger.debug(f"Could not resolve gpu_ids support: {e}")
+ return False, True
+ _gguf_pin_support_cache = (now, (llama_uses_vulkan, gpu_ids_supported))
+ return llama_uses_vulkan, gpu_ids_supported
+
+
def _get_cached_system_gpu_info(
- logger, *, refresh_memory: bool = False
+ logger,
+ *,
+ refresh_memory: bool = False,
+ max_age_s: float = _SYSTEM_GPU_CACHE_TTL_SECONDS,
) -> tuple[dict[str, Any], dict[str, Any]]:
"""Return training and inference GPU info with bounded live-probe churn."""
import contextlib
@@ -2558,12 +2645,21 @@ def _get_cached_system_gpu_info(
gpu_query,
)
- global _system_gpu_cache
- now = time.monotonic()
+ global _system_gpu_cache, _system_gpu_probe_s
with _system_gpu_cache_lock:
+ now = time.monotonic()
+ max_age_s = min(
+ _SYSTEM_GPU_CACHE_TTL_SECONDS,
+ max(max_age_s, _SYSTEM_GPU_PROBE_SPACING * _system_gpu_probe_s),
+ )
+ within_window = (
+ not refresh_memory
+ and _system_gpu_cache is not None
+ and now - _system_gpu_cache[0] < _SYSTEM_GPU_CACHE_TTL_SECONDS
+ )
if not refresh_memory and _system_gpu_cache is not None:
cached_at, cached_gpu_info = _system_gpu_cache
- if now - cached_at < _SYSTEM_GPU_CACHE_TTL_SECONDS:
+ if now - cached_at < max_age_s:
return cached_gpu_info
try:
@@ -2627,23 +2723,7 @@ def _get_cached_system_gpu_info(
d.get("index") for d in utilization_info.get("devices", [])
} == {d.get("index") for d in enriched_devices}
- try:
- from core.inference.llama_cpp import LlamaCppBackend
- from utils.hardware import DeviceType, get_device
-
- llama_uses_vulkan = LlamaCppBackend._is_vulkan_backend()
- if llama_uses_vulkan:
- # Vulkan ordinals live in another namespace; a failed probe must not expose torch indices.
- gpu_ids_supported = False
- else:
- # XPU pins are unsafe across Level Zero FLAT/COMPOSITE; CPU-only llama.cpp cannot pin.
- gpu_ids_supported = (
- get_device() != DeviceType.XPU and not LlamaCppBackend._backend_lacks_gpu_lib()
- )
- except Exception as e:
- logger.debug(f"Could not resolve gpu_ids support: {e}")
- llama_uses_vulkan = False
- gpu_ids_supported = True
+ llama_uses_vulkan, gpu_ids_supported = _gguf_pin_support(logger, refresh = not within_window)
# physical_devices and mismatch hold GPUs the OS sees but PyTorch cannot open; devices is usable.
gpu_info = {
**visibility_info,
@@ -2694,6 +2774,7 @@ def _get_cached_system_gpu_info(
combined_info = (gpu_info, inference_gpu_info)
_system_gpu_cache = (time.monotonic(), combined_info)
+ _system_gpu_probe_s = _system_gpu_cache[0] - now
return combined_info
@@ -2753,10 +2834,22 @@ def _refresh_dense_quant_capability() -> bool:
return _dense_quant_capability
+_DENSE_QUANT_REPROBE_S = 5.0
+_dense_quant_probed_at: Optional[float] = None
+
+
def _dense_quant_supported() -> bool:
"""Reads only already-loaded state: importing torch or torchao on this polled route stalls the GIL."""
+ global _dense_quant_probed_at
if "torch" in sys.modules and "torchao" in sys.modules:
- return _refresh_dense_quant_capability()
+ now = time.monotonic()
+ if (
+ _dense_quant_capability is None
+ or _dense_quant_probed_at is None
+ or now - _dense_quant_probed_at >= _DENSE_QUANT_REPROBE_S
+ ):
+ _dense_quant_probed_at = now
+ return _refresh_dense_quant_capability()
return bool(_dense_quant_capability)
@@ -2861,6 +2954,7 @@ def _dense_quant_schemes() -> list[str]:
def get_system_info(
current_subject: str = Depends(get_current_subject),
refresh_memory: bool = False,
+ gpu_max_age: Optional[float] = None,
probe_media: bool = False,
):
"""Get system information.
@@ -2901,7 +2995,9 @@ def get_system_info(
logger.debug("quantised streaming capability unavailable: %s", exc)
gpu_info, inference_gpu_info = _get_cached_system_gpu_info(
- logger, refresh_memory = refresh_memory
+ logger,
+ refresh_memory = refresh_memory,
+ **({} if gpu_max_age is None else {"max_age_s": _system_gpu_max_age_s(gpu_max_age)}),
)
memory = psutil.virtual_memory()
@@ -2966,14 +3062,7 @@ def get_system_info(
# Read versions from metadata so a 3s poll never imports heavy ML libs (or 500s on their import errors).
from importlib.metadata import PackageNotFoundError, version as pkg_version
- ml_packages = {}
- for pkg in ("torch", "transformers", "mlx_lm", "mlx_vlm"):
- try:
- ml_packages[pkg] = pkg_version(pkg)
- except PackageNotFoundError:
- pass
- except Exception as e:
- logger.debug(f"Failed to read {pkg} version: {e}")
+ ml_packages = _ml_package_versions(pkg_version, PackageNotFoundError)
return {
"memory_refreshed": refresh_memory,
diff --git a/studio/backend/models/inference.py b/studio/backend/models/inference.py
index 47c71e74183..5122741fe2f 100644
--- a/studio/backend/models/inference.py
+++ b/studio/backend/models/inference.py
@@ -2363,6 +2363,10 @@ class InferenceStatusResponse(_InferenceRuntimeFields):
None,
description = "Best-effort memory the resident model holds, in MiB; null when unknown.",
)
+ resident_on_gpu: Optional[bool] = Field(
+ None,
+ description = "True when resident_mib is model buffers on the GPUs /api/system reports, false for a CPU-only llama.cpp build, null when unknown (Vulkan or SYCL buffers are not parsed).",
+ )
active_model: Optional[str] = Field(
None, description = "Currently active model display identifier"
)
diff --git a/studio/backend/routes/inference.py b/studio/backend/routes/inference.py
index 8c5d529438a..f66e7833f88 100644
--- a/studio/backend/routes/inference.py
+++ b/studio/backend/routes/inference.py
@@ -9010,10 +9010,12 @@ async def _reap_exited_workers() -> None:
await asyncio.to_thread(_reap_dead_workers, exited)
-async def _route_to_extra_slot(requested: Optional[str]) -> Optional[_ExtraSlot]:
+async def _route_to_extra_slot(
+ requested: Optional[str], touch: bool = True
+) -> Optional[_ExtraSlot]:
"""Route this request to the kept model serving *requested*, if any. The primary wins a tie."""
await _reap_exited_workers()
- return await model_slots.route(requested, _loaded_satisfies)
+ return await model_slots.route(requested, _loaded_satisfies, touch)
def _model_key(request: LoadRequest) -> str:
@@ -22394,10 +22396,10 @@ async def inference_status(
async def get_status(current_subject: str, model: Optional[str] = None):
"""Status of the slot serving ``model`` (the primary one by default), listing every loaded model."""
- slot = await _route_to_extra_slot(model)
+ slot = await _route_to_extra_slot(model, touch = False)
response = await _slot_status(current_subject)
if isinstance(response, InferenceStatusResponse) and response.is_gguf:
- response.resident_mib = _llama_resident_mib()
+ response.resident_mib, response.resident_on_gpu = _llama_resident()
if isinstance(response, InferenceStatusResponse):
from utils.multi_model_settings import get_multi_model_mode
@@ -22420,13 +22422,26 @@ async def get_status(current_subject: str, model: Optional[str] = None):
return response
-def _llama_resident_mib() -> Optional[int]:
- """The routed slot's llama-server footprint; None when not loaded or unreadable."""
+def _llama_resident() -> "tuple[Optional[int], Optional[bool]]":
+ """The routed slot's llama-server footprint, and whether it is model buffers on the GPUs /api/system
+ reports: True (parsed buffers), False (a CPU-only build's RSS), None (unknown)."""
try:
llama = get_llama_cpp_backend()
- return llama.resident_memory_mib() if getattr(llama, "is_loaded", False) else None
+ if not getattr(llama, "is_loaded", False):
+ return None, None
+ mib = llama.resident_memory_mib()
+ if mib is None:
+ return None, None
+ # resident_memory_mib() reports these buffers when there are any, else falls back to RSS.
+ buffers = getattr(llama, "reclaimable_gpu_memory_gb", None)
+ if callable(buffers) and buffers():
+ return mib, True
+ from core.inference.llama_cpp import LlamaCppBackend as _Llama
+
+ # No parsed buffers proves nothing (Vulkan, SYCL); only a CPU-only build is a CPU run.
+ return mib, (False if _Llama._backend_lacks_gpu_lib() else None)
except Exception: # noqa: BLE001 - optional decoration on a status read
- return None
+ return None, None
def _slot_entries_and_checkpoints() -> "tuple[list[dict], dict[str, str]]":
diff --git a/studio/backend/tests/test_loaded_model_resident_mib.py b/studio/backend/tests/test_loaded_model_resident_mib.py
index 8f464f5b910..5de9c3d1ef2 100644
--- a/studio/backend/tests/test_loaded_model_resident_mib.py
+++ b/studio/backend/tests/test_loaded_model_resident_mib.py
@@ -124,6 +124,24 @@ def test_media_owner_sums_its_own_gpus_only(media_needs):
assert gr.media_owner_held_mib(arb.VIDEO) == 9000
+class _Need(dict):
+ headroom_mib = 3000
+
+
+def test_an_idle_media_owner_holds_its_weights_not_its_generation_headroom(
+ media_needs, monkeypatch
+):
+ media_needs._residents = {arb.DIFFUSION: frozenset({0})}
+ media_needs._owner = arb.DIFFUSION
+ media_needs._media_needs = {arb.DIFFUSION: _Need({0: 7000})}
+ monkeypatch.setattr(gr, "_media_busy", lambda owner: (False, False))
+ assert gr.media_owner_held_mib(arb.DIFFUSION) == 4000
+ monkeypatch.setattr(gr, "_media_busy", lambda owner: (False, True))
+ assert gr.media_owner_held_mib(arb.DIFFUSION) == 7000
+ monkeypatch.setattr(gr, "_media_busy", lambda owner: (True, False))
+ assert gr.media_owner_held_mib(arb.DIFFUSION) is None
+
+
def test_unpriced_media_owner_is_none(media_needs):
assert gr.media_owner_held_mib(arb.VIDEO) is None
media_needs._media_needs = {arb.VIDEO: {0: "lots"}}
@@ -167,3 +185,36 @@ def test_a_failing_probe_leaves_the_size_unknown(monkeypatch):
def test_a_non_gguf_status_is_not_sized_from_llama(monkeypatch):
backend = SimpleNamespace(is_loaded = True, resident_memory_mib = lambda: 2048)
assert _run_status(monkeypatch, backend, is_gguf = False).resident_mib is None
+
+
+def test_status_says_whether_the_size_is_gpu_buffers_or_unknown(monkeypatch):
+ # RSS (a CPU run) or unparsed buffers (Vulkan) are not known to sit on the reported GPUs.
+ on_gpu = SimpleNamespace(
+ is_loaded = True,
+ resident_memory_mib = lambda: 4096,
+ reclaimable_gpu_memory_gb = lambda: {0: 4.0},
+ )
+ status = _run_status(monkeypatch, on_gpu)
+ assert (status.resident_mib, status.resident_on_gpu) == (4096, True)
+ on_cpu = SimpleNamespace(
+ is_loaded = True,
+ resident_memory_mib = lambda: 3072,
+ reclaimable_gpu_memory_gb = lambda: None,
+ )
+ monkeypatch.setattr(LlamaCppBackend, "_backend_lacks_gpu_lib", staticmethod(lambda: True))
+ status = _run_status(monkeypatch, on_cpu)
+ assert (status.resident_mib, status.resident_on_gpu) == (3072, False)
+ # A GPU build with no parsed buffers (Vulkan, SYCL) says nothing about which pool holds the model.
+ monkeypatch.setattr(LlamaCppBackend, "_backend_lacks_gpu_lib", staticmethod(lambda: False))
+ status = _run_status(monkeypatch, on_cpu)
+ assert (status.resident_mib, status.resident_on_gpu) == (3072, None)
+
+
+def test_an_unknown_size_says_nothing_about_its_pool(monkeypatch):
+ backend = SimpleNamespace(
+ is_loaded = True,
+ resident_memory_mib = lambda: None,
+ reclaimable_gpu_memory_gb = lambda: None,
+ )
+ status = _run_status(monkeypatch, backend)
+ assert (status.resident_mib, status.resident_on_gpu) == (None, None)
diff --git a/studio/backend/tests/test_multi_model_serving.py b/studio/backend/tests/test_multi_model_serving.py
index fda5d225111..1aeee3c57e3 100644
--- a/studio/backend/tests/test_multi_model_serving.py
+++ b/studio/backend/tests/test_multi_model_serving.py
@@ -279,6 +279,21 @@ def test_status_describes_the_named_slot_and_lists_the_rest(backends, monkeypatc
assert asyncio.run(inf.get_status("s")).serving == ["org/A-GGUF"]
+def test_a_status_read_does_not_count_as_use_for_eviction(backends, monkeypatch):
+ # The Loaded models poll sizes every kept model by name; that must not reorder the LRU.
+ _, extra = backends
+ extra.last_used = 1.0
+
+ async def slot_status(subject):
+ return InferenceStatusResponse(active_model = inf.get_llama_cpp_backend().model_identifier)
+
+ monkeypatch.setattr(inf, "_slot_status", slot_status)
+ named = asyncio.run(inf.get_status("s", model = "org/B-GGUF"))
+ assert named.active_model == "org/B-GGUF"
+ assert extra.last_used == 1.0
+ assert _routed("org/B-GGUF")[0] is extra and extra.last_used > 1.0
+
+
def test_status_pairs_each_serving_model_with_the_checkpoint_to_select_it_by(backends, monkeypatch):
_, extra = backends
local, twin = "/home/alice/models/B-local.gguf", "/home/alice/other/B-local.gguf"
diff --git a/studio/backend/tests/test_system_gpu_max_age.py b/studio/backend/tests/test_system_gpu_max_age.py
new file mode 100644
index 00000000000..c27fe7661d5
--- /dev/null
+++ b/studio/backend/tests/test_system_gpu_max_age.py
@@ -0,0 +1,105 @@
+# SPDX-License-Identifier: AGPL-3.0-only
+# Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
+
+"""The Live monitor polls /api/system every 1-10 s; GPU readings follow it, never faster than 1 s."""
+
+import types
+
+
+def test_requested_gpu_age_is_clamped_to_one_to_ten_seconds():
+ import main
+
+ assert main._system_gpu_max_age_s(None) == main._SYSTEM_GPU_CACHE_TTL_SECONDS
+ assert main._system_gpu_max_age_s(1) == 1.0
+ assert main._system_gpu_max_age_s(0.1) == 1.0
+ assert main._system_gpu_max_age_s(60) == main._SYSTEM_GPU_CACHE_TTL_SECONDS
+ assert main._system_gpu_max_age_s(float("nan")) == main._SYSTEM_GPU_CACHE_TTL_SECONDS
+
+
+def test_route_passes_the_age_only_when_asked(monkeypatch):
+ import main
+
+ seen = []
+
+ def fake(logger, **kwargs):
+ seen.append(kwargs)
+ return {"available": False}, {"available": False}
+
+ monkeypatch.setattr(main, "_get_cached_system_gpu_info", fake)
+ main.get_system_info(current_subject = "test")
+ main.get_system_info(current_subject = "test", gpu_max_age = 1)
+ assert "max_age_s" not in seen[0]
+ assert seen[1]["max_age_s"] == 1.0
+
+
+def test_dense_quant_reprobe_is_throttled(monkeypatch):
+ import sys
+
+ import main
+
+ calls = []
+ monkeypatch.setitem(sys.modules, "torch", sys.modules.get("torch") or types.ModuleType("torch"))
+ monkeypatch.setitem(sys.modules, "torchao", types.ModuleType("torchao"))
+ monkeypatch.setattr(main, "_refresh_dense_quant_capability", lambda: calls.append(1) or True)
+ monkeypatch.setattr(main, "_dense_quant_capability", True)
+ monkeypatch.setattr(main, "_dense_quant_probed_at", None)
+ clock = iter([100.0, 101.0, 104.9, 105.1])
+ monkeypatch.setattr(main.time, "monotonic", lambda: next(clock))
+ for _ in range(4):
+ main._dense_quant_supported()
+ # Probed at 100, skipped at 101 and 104.9, probed again at 105.1.
+ assert len(calls) == 2
+
+
+def test_process_tree_children_are_reused_within_the_ttl(monkeypatch):
+ import psutil
+
+ import main
+
+ scans = []
+ me = psutil.Process()
+ monkeypatch.setattr(main, "_descendants_cache", {})
+ monkeypatch.setattr(type(me), "children", lambda self, recursive = False: scans.append(1) or [])
+ main._cached_descendants(me)
+ main._cached_descendants(me)
+ assert len(scans) == 1
+
+
+def test_llama_pin_support_is_not_rescanned_on_every_fast_read(monkeypatch):
+ import logging
+
+ import main
+ from core.inference.llama_cpp import LlamaCppBackend
+
+ scans = []
+ monkeypatch.setattr(main, "_gguf_pin_support_cache", None)
+ monkeypatch.setattr(
+ LlamaCppBackend, "_is_vulkan_backend", staticmethod(lambda: scans.append(1) or False)
+ )
+ monkeypatch.setattr(LlamaCppBackend, "_backend_lacks_gpu_lib", staticmethod(lambda: False))
+ log = logging.getLogger("t")
+ main._gguf_pin_support(log, refresh = True)
+ main._gguf_pin_support(log)
+ main._gguf_pin_support(log)
+ assert len(scans) == 1
+ # A full (past-the-window) read re-resolves, so a reinstall shows within 10 s.
+ main._gguf_pin_support(log, refresh = True)
+ assert len(scans) == 2
+
+
+def test_a_slow_gpu_probe_spaces_out_fast_polls(monkeypatch):
+ import logging
+
+ import main
+
+ cached = ({"available": True, "devices": []}, {"available": True, "devices": []})
+ now = main.time.monotonic()
+ monkeypatch.setattr(main, "_system_gpu_cache", (now - 2.0, cached))
+ log = logging.getLogger("t")
+ # A 1.5 s probe (Windows ROCm) keeps a 2 s old reading for a 1 s poll.
+ monkeypatch.setattr(main, "_system_gpu_probe_s", 1.5)
+ assert main._get_cached_system_gpu_info(log, max_age_s = 1.0) is cached
+ # A fast probe lets the same poll through to a fresh read.
+ monkeypatch.setattr(main, "_system_gpu_probe_s", 0.05)
+ monkeypatch.setattr(main, "_system_gpu_cache", (now - 2.0, cached))
+ assert main._get_cached_system_gpu_info(log, max_age_s = 1.0) is not cached
diff --git a/studio/frontend/src/components/floating-monitor-layout.ts b/studio/frontend/src/components/floating-monitor-layout.ts
index c1b68676ffa..744f2350b28 100644
--- a/studio/frontend/src/components/floating-monitor-layout.ts
+++ b/studio/frontend/src/components/floating-monitor-layout.ts
@@ -28,7 +28,6 @@ export interface FloatingMonitorDockState {
sidebarWidth: number;
/** Viewport width; 0 or less means unknown, which skips the capacity check. */
viewportWidth: number;
- /** The monitor's rendered width; natively resizable, so `w-64` is a floor. */
monitorWidth?: number;
uiSpaceScale?: number;
}
diff --git a/studio/frontend/src/components/floating-monitor.tsx b/studio/frontend/src/components/floating-monitor.tsx
index 60c45ae2762..55bda8899d6 100644
--- a/studio/frontend/src/components/floating-monitor.tsx
+++ b/studio/frontend/src/components/floating-monitor.tsx
@@ -1,7 +1,10 @@
// SPDX-License-Identifier: AGPL-3.0-only
// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
-import { FLOATING_PANEL_POSITION_KEYS } from "@/hooks/floating-panel-position";
+import {
+ FLOATING_PANEL_POSITION_KEYS,
+ type ResizeEdges,
+} from "@/hooks/floating-panel-position";
import { useFloatingPanelLayout } from "@/hooks/use-floating-panel-layout";
import { Button } from "@/components/ui/button";
import { Progress } from "@/components/ui/progress";
@@ -9,6 +12,18 @@ import { useChatRuntimeStore } from "@/features/chat/stores/chat-runtime-store";
import { FIND_PORTAL_ATTRIBUTE } from "@/features/find-in-page/lib/find-attributes";
import { useMonitorOverlayStore } from "@/features/settings/stores/monitor-overlay-store";
+import { monitorRefreshMs } from "./monitor-refresh";
+import { holdsModelsInVram, vramCards } from "./monitor-cards";
+import {
+ formatGiB,
+ MeterRow,
+ MemoryShareBar,
+ UsageBar,
+ usageIndicatorClass,
+ usageTextClass,
+} from "./monitor-memory";
+import { inferenceGpuDisjoint, poolSplit } from "./monitor-share";
+import type { LoadedModelEntry } from "@/features/loaded-models";
import { useCornerCardFrameStore } from "@/features/settings/stores/monitor-frame-store";
import { gpuMemoryDisplay } from "@/hooks/gpu-memory-display";
import { gpuMemoryTotalsGb, resolveGpuVramUsedGb } from "@/hooks/gpu-vram";
@@ -25,7 +40,14 @@ import {
import { cn } from "@/lib/utils";
import { useRouterState } from "@tanstack/react-router";
import { AnimatePresence, motion } from "motion/react";
-import { useEffect, useRef, useState, useSyncExternalStore } from "react";
+import {
+ lazy,
+ Suspense,
+ useEffect,
+ useRef,
+ useState,
+ useSyncExternalStore,
+} from "react";
import {
formatPower,
@@ -48,26 +70,6 @@ function clampPercent(value: number): number {
return Math.max(0, Math.min(100, value));
}
-function usageIndicatorClass(percent: number): string {
- if (percent >= 90) {
- return "bg-destructive";
- }
- if (percent >= 70) {
- return "bg-amber-500";
- }
- return "bg-control-accent";
-}
-
-function usageTextClass(percent: number): string {
- if (percent >= 90) {
- return "text-destructive";
- }
- if (percent >= 70) {
- return "text-amber-600 dark:text-amber-400";
- }
- return "text-primary";
-}
-
const LEVEL_INDICATOR_CLASS = {
ok: "bg-control-accent",
warm: "bg-amber-500",
@@ -95,9 +97,9 @@ function DetailBar({
}) {
return (
<div className="space-y-0.5">
- <div className="flex justify-between gap-2 text-xs font-mono text-muted-foreground">
+ <div className="flex justify-between gap-2 text-xs text-muted-foreground">
<span className="truncate">{label}</span>
- <span className={cn("shrink-0 tabular-nums", textClassName)}>
+ <span className={cn("shrink-0 font-mono tabular-nums", textClassName)}>
{value}
</span>
</div>
@@ -110,11 +112,28 @@ function DetailBar({
);
}
-function formatGiB(value: number): string {
- // Backend reports binary units (bytes / 1024**3), so label GiB.
- const digits = value >= 10 ? 1 : 2;
- return `${value.toFixed(digits)} GiB`;
-}
+const MonitorLoadedModels = lazy(() => import("./monitor-loaded-models"));
+
+const BACKGROUND_DRAG_EXCLUDED =
+ 'button, a, input, select, textarea, [role="button"], [data-testid="floating-monitor-resize"]';
+
+const RESIZE_HANDLES: { edge: string; edges: ResizeEdges; className: string }[] = [
+ { edge: "w", edges: { x: -1, y: 0 }, className: "inset-y-0 left-0 w-1.5 cursor-ew-resize" },
+ { edge: "e", edges: { x: 1, y: 0 }, className: "inset-y-0 right-0 w-1.5 cursor-ew-resize" },
+ { edge: "nw", edges: { x: -1, y: -1 }, className: "left-0 top-0 z-20 size-3 cursor-nwse-resize" },
+ { edge: "se", edges: { x: 1, y: 1 }, className: "bottom-0 right-0 z-20 size-5 cursor-nwse-resize" },
+ { edge: "ne", edges: { x: 1, y: -1 }, className: "right-0 top-0 z-20 size-3 cursor-nesw-resize" },
+ { edge: "sw", edges: { x: -1, y: 1 }, className: "bottom-0 left-0 z-20 size-5 cursor-nesw-resize" },
+];
+
+const MONITOR_RESIZE = {
+ minWidth: 232,
+ maxWidth: 520,
+ // w-64, in the root font size Studio's text scale sets.
+ defaultWidth: () =>
+ 16 * Number.parseFloat(getComputedStyle(document.documentElement).fontSize),
+ storageKey: FLOATING_PANEL_POSITION_KEYS.liveMonitorWidth,
+};
interface FloatingMonitorPanelProps {
dockedBesideRunSettings: boolean;
@@ -148,6 +167,11 @@ function FloatingMonitorPanel({
finishDrag,
resetPosition,
nudge,
+ width,
+ startResize,
+ updateResize,
+ finishResize,
+ resetWidth,
} = useFloatingPanelLayout(
constraintsElement,
dockedBesideRunSettings || suppressed,
@@ -155,6 +179,7 @@ function FloatingMonitorPanel({
undefined,
FLOATING_PANEL_POSITION_KEYS.liveMonitor,
cornerCard,
+ MONITOR_RESIZE,
);
// offsetWidth, not the bounding rect: a drag's transform skews the rect.
@@ -201,7 +226,6 @@ function FloatingMonitorPanel({
: 0;
const devices = memoryDisplay.usageDevices;
const memoryTotals = gpuMemoryTotalsGb(devices);
- const vramTotal = memoryTotals.total;
const hasSharedPool = memoryTotals.shared > 0;
// No dedicated pool (Apple unified memory): the shared total alone is the capacity.
const unifiedPool = hasSharedPool && memoryTotals.dedicated === 0;
@@ -210,9 +234,6 @@ function FloatingMonitorPanel({
const resolvedVramUsed = resolveGpuVramUsedGb(memoryDisplay.usageGpu);
const vramUsageKnown = resolvedVramUsed !== null;
const vramUsed = resolvedVramUsed ?? 0;
- const vramPercent = clampPercent(
- vramUsageKnown && vramTotal > 0 ? (vramUsed / vramTotal) * 100 : 0,
- );
const unknownLabel = t("settings.resources.environment.unknown");
const showDetails = useMonitorOverlayStore((state) => state.showDetails);
@@ -220,10 +241,9 @@ function FloatingMonitorPanel({
(state) => state.detailMetrics,
);
const detailMetrics = selectedDetailMetrics(storedDetailMetrics);
- const cpuPercent =
- showDetails && detailMetrics.has("cpuLoad") && systemInfo.status === "ready"
- ? clampPercent(systemInfo.cpu?.usage_percent ?? 0)
- : null;
+ const cpuPercent = ramKnown
+ ? clampPercent(systemInfo.cpu?.usage_percent ?? 0)
+ : null;
const telemetryRows =
showDetails && displayedGpu?.available
? gpuTelemetryRows(displayedGpu.devices, detailMetrics)
@@ -232,6 +252,52 @@ function FloatingMonitorPanel({
const hasGpu =
(displayedGpu?.available ?? false) &&
(displayedGpu?.devices.length ?? 0) > 0;
+ // Apple unified memory: RAM and "VRAM" are one pool, so two bars contradict each other.
+ const unifiedRow =
+ hasGpu &&
+ devices.length > 0 &&
+ unifiedPool &&
+ memoryDisplay.sharedDevices.length === 0;
+ const discreteVram = hasGpu && devices.length > 0 && !unifiedRow;
+ const vram = vramCards(devices, memoryDisplay.usageGpu);
+ const cardsUsedKnown = vram.usedGb !== null;
+ const cardsUsed = vram.usedGb ?? 0;
+ const cardsPercent = clampPercent(
+ cardsUsedKnown && vram.totalGb > 0 ? (cardsUsed / vram.totalGb) * 100 : 0,
+ );
+ // An APU's carve-out shows as VRAM, but its models count in RAM, as in Settings.
+ const modelsInVram = discreteVram && holdsModelsInVram(vram.cards);
+ const cardLabel =
+ vram.cards.length === 1 ? (vram.cards[0]?.name ?? undefined) : undefined;
+
+ const showShare = useMonitorOverlayStore((state) => state.showUnslothShare);
+ const showBreakdown = useMonitorOverlayStore(
+ (state) => state.showModelBreakdown,
+ );
+ const wantsModels = showShare || showBreakdown;
+ const [loadedModels, setLoadedModels] = useState<LoadedModelEntry[]>([]);
+ const processMb =
+ systemInfo.memory?.process_tree_used_mb ?? systemInfo.memory?.process_used_mb;
+ const split = poolSplit({
+ entries: loadedModels,
+ showShare,
+ showBreakdown,
+ modelsInVram,
+ inferenceGpuElsewhere: inferenceGpuDisjoint(
+ systemInfo.gpu?.backend,
+ separateInferenceGpu?.backend,
+ ),
+ processGb: ramKnown && processMb !== undefined ? processMb / 1024 : null,
+ ramUsedGb: ramUsed,
+ ramTotalGb: ramTotal,
+ vramUsedGb: vram.usedGb,
+ vramTotalGb: vram.totalGb,
+ });
+ const ramSegments = split.ram;
+ const vramSegments = split.vram;
+ const ramAmount = ramKnown
+ ? `${formatGiB(ramUsed)} / ${formatGiB(ramTotal)}`
+ : "-- / --";
// The container sits on the floating panel layer, above the bottom-right overlay stack. The stack
// is anchored to that same corner and does not move for this monitor; at its default corner the
@@ -260,14 +326,33 @@ function FloatingMonitorPanel({
{...{ [FIND_PORTAL_ATTRIBUTE]: "" }}
ref={monitorRef}
onPointerDownCapture={() => raisePanel("resource-monitor")}
+ // The whole card is a grip; controls, resize edges and the grip itself keep their own pointer.
+ onPointerDown={(event) => {
+ if (
+ event.target instanceof Element &&
+ event.target.closest(BACKGROUND_DRAG_EXCLUDED)
+ ) {
+ return;
+ }
+ // A classic scrollbar sits inside the scroller's box but right of its client area.
+ const target = event.target as HTMLElement;
+ if (event.nativeEvent.offsetX > target.clientWidth && target.clientWidth > 0) {
+ return;
+ }
+ startDrag(event);
+ }}
+ onPointerMove={updateDrag}
+ onPointerUp={finishDrag}
+ onPointerCancel={finishDrag}
+ onLostPointerCapture={finishDrag}
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
className={cn(
// transition-none: reduce motion's 0.01ms duration otherwise turns the drop's transform to
// left/top handoff into a transition, and the compositor paints a frame at the start spot.
- "settings-surface bg-background pointer-events-auto absolute flex max-h-full w-64 transition-none max-w-full cursor-default select-none flex-col overflow-hidden rounded-2xl border border-border/70 p-3 shadow-border ring-0",
- layout ? "top-0 left-0 resize" : "right-0 bottom-0",
+ "settings-surface bg-background pointer-events-auto absolute flex max-h-full w-64 transition-none max-w-full cursor-grab select-none active:cursor-grabbing flex-col overflow-hidden rounded-2xl border border-border/70 p-3 shadow-border ring-0",
+ layout ? "top-0 left-0" : "right-0 bottom-0",
)}
data-testid="floating-monitor"
// Takes its own clicks over a macOS browser page (native-view.ts).
@@ -289,10 +374,32 @@ function FloatingMonitorPanel({
minHeight: Math.min(layout.minHeight, layout.maxHeight),
maxWidth: layout.maxWidth,
maxHeight: layout.maxHeight,
+ width: width ?? undefined,
}
- : undefined
+ : { width: width ?? undefined }
}
>
+ {wantsModels && !suppressed && (
+ <Suspense fallback={null}>
+ <MonitorLoadedModels onEntries={setLoadedModels} />
+ </Suspense>
+ )}
+ {RESIZE_HANDLES.map(({ edge, edges, className }) => (
+ <div
+ key={edge}
+ aria-hidden
+ data-testid="floating-monitor-resize"
+ data-edge={edge}
+ title={t("floatingPanels.monitor.resizeHint")}
+ onPointerDown={(event) => startResize(event, edges)}
+ onPointerMove={updateResize}
+ onPointerUp={finishResize}
+ onPointerCancel={finishResize}
+ onLostPointerCapture={finishResize}
+ onDoubleClick={resetWidth}
+ className={cn("absolute z-10 touch-none", className)}
+ />
+ ))}
<div className="mb-2 flex items-center justify-between gap-2 border-b border-border/60 pb-2">
<div className="flex min-w-0 flex-1 items-center gap-1.5 truncate text-xs font-semibold text-foreground">
<HugeiconsIcon icon={ChipIcon} strokeWidth={2} className="size-3.5 shrink-0 text-primary" />
@@ -348,86 +455,110 @@ function FloatingMonitorPanel({
data-testid="floating-monitor-content"
className={cn("space-y-3 transition-opacity", stale && "opacity-50")}
>
- <div className="space-y-1">
- <div className="flex justify-between text-ui-11 font-medium font-mono">
- <span>{t("settings.resources.liveMonitor.ram")}</span>
- <span
- className={cn(
- "tabular-nums",
- ramKnown
- ? usageTextClass(ramPercent)
- : "text-muted-foreground",
- )}
- >
- {ramKnown ? `${Math.round(ramPercent)}%` : "--"}
- </span>
- </div>
- <div className="text-xs text-muted-foreground font-mono tabular-nums">
- {ramKnown
- ? `${formatGiB(ramUsed)} / ${formatGiB(ramTotal)}`
- : "-- / --"}
- </div>
- <Progress
- value={ramKnown ? ramPercent : 0}
- className="mt-1 h-1.5 rounded-full bg-muted"
- indicatorClassName={usageIndicatorClass(ramPercent)}
- />
- </div>
-
- {hasGpu && devices.length > 0 && (
- <div className="space-y-1">
- <div className="flex justify-between text-ui-11 font-medium font-mono">
- <span className="truncate flex-1 pr-2">
- {t("settings.resources.liveMonitor.vram")}{" "}
- {devices.length > 1
- ? `(${devices.length} GPUs)`
- : `(${devices[0].name ?? "GPU"})`}
- </span>
- <span
- className={cn(
- "shrink-0 tabular-nums",
- vramUsageKnown
- ? usageTextClass(vramPercent)
- : "text-muted-foreground",
- )}
- >
- {vramUsageKnown ? `${Math.round(vramPercent)}%` : "--"}
- </span>
- </div>
- <div className="text-xs text-muted-foreground font-mono tabular-nums">
- {vramUsageKnown ? formatGiB(vramUsed) : unknownLabel} /{" "}
- {hasSharedPool && !unifiedPool
- ? t("settings.resources.environment.vramWithShared", {
- vram: formatGiB(memoryTotals.dedicated),
- shared: formatGiB(memoryTotals.shared),
- })
- : formatGiB(vramTotal)}
- </div>
- {unifiedPool && memoryDisplay.sharedDevices.length === 0 && (
- <div className="text-xs font-mono text-muted-foreground">
- {t("settings.resources.gpu.sharedWithSystemRam")}
- {memoryDisplay.unifiedAvailableGb !== null && (
- <span className="block">
- {t("settings.resources.gpu.estimatedAvailable", {
- value: formatGiB(memoryDisplay.unifiedAvailableGb),
- })}
+ <MeterRow
+ testId="floating-monitor-cpu"
+ label={t("settings.resources.liveMonitor.cpu")}
+ readout={cpuPercent === null ? "--" : `${Math.round(cpuPercent)}%`}
+ readoutClassName={
+ cpuPercent === null ? undefined : usageTextClass(cpuPercent)
+ }
+ >
+ <UsageBar percent={cpuPercent} />
+ </MeterRow>
+ <MeterRow
+ testId={unifiedRow ? "floating-monitor-memory" : "floating-monitor-ram"}
+ label={
+ unifiedRow
+ ? t("settings.resources.liveMonitor.memory")
+ : t("settings.resources.liveMonitor.ram")
+ }
+ readout={ramAmount}
+ footer={
+ unifiedRow &&
+ !ramSegments && (
+ <>
+ <div className="flex justify-between gap-2">
+ <span>{t("settings.resources.liveMonitor.gpuInUse")}</span>
+ <span className="shrink-0 font-mono tabular-nums">
+ {vramUsageKnown ? formatGiB(vramUsed) : unknownLabel}
</span>
- )}
- </div>
- )}
- <Progress
- value={vramUsageKnown ? vramPercent : 0}
- className="mt-1 h-1.5 rounded-full bg-muted"
- indicatorClassName={usageIndicatorClass(vramPercent)}
+ </div>
+ {memoryDisplay.unifiedAvailableGb !== null && (
+ <div className="flex justify-between gap-2">
+ <span>
+ {t("settings.resources.liveMonitor.availableForModels")}
+ </span>
+ <span className="shrink-0 font-mono tabular-nums">
+ {formatGiB(memoryDisplay.unifiedAvailableGb)}
+ </span>
+ </div>
+ )}
+ </>
+ )
+ }
+ >
+ {ramSegments ? (
+ <MemoryShareBar
+ segments={ramSegments}
+ noModels={!modelsInVram && split.noModels}
/>
- </div>
+ ) : (
+ <UsageBar percent={ramKnown ? ramPercent : null} />
+ )}
+ </MeterRow>
+ {/* One card, an aggregate the cards cannot split, or the share on: one VRAM row over every card. */}
+ {discreteVram && (vram.showTotal || vramSegments) && (
+ <MeterRow
+ testId="floating-monitor-vram"
+ label={t("settings.resources.liveMonitor.vram")}
+ readout={`${cardsUsedKnown ? formatGiB(cardsUsed) : "--"} / ${formatGiB(vram.totalGb)}`}
+ footer={
+ cardLabel && (
+ <div className="truncate" title={cardLabel}>
+ {cardLabel}
+ </div>
+ )
+ }
+ >
+ {vramSegments ? (
+ <MemoryShareBar
+ segments={vramSegments}
+ noModels={split.noModels}
+ />
+ ) : (
+ <UsageBar percent={cardsUsedKnown ? cardsPercent : null} />
+ )}
+ </MeterRow>
)}
+ {/* Several cards: each is a row of its own, the same size as the rest. */}
+ {discreteVram &&
+ vram.rows.map((row) => {
+ const percent =
+ row.usedGb !== null && row.totalGb > 0
+ ? clampPercent((row.usedGb / row.totalGb) * 100)
+ : null;
+ return (
+ <MeterRow
+ key={row.key}
+ testId="floating-monitor-gpu-card"
+ label={row.label}
+ readout={`${row.usedGb === null ? "--" : formatGiB(row.usedGb)} / ${formatGiB(row.totalGb)}`}
+ footer={
+ <div className="truncate" title={row.title}>
+ {row.name}
+ </div>
+ }
+ >
+ <UsageBar percent={percent} />
+ </MeterRow>
+ );
+ })}
{hasGpu && memoryDisplay.sharedDevices.length > 0 && (
<div className="space-y-1 text-xs">
<div className="font-medium">
{t("settings.resources.gpu.sharedWithSystemRam")}
</div>
- <div className="font-mono text-muted-foreground">
+ <div className="font-mono tabular-nums text-muted-foreground">
{t("settings.resources.gpu.estimatedAvailable", {
value:
memoryDisplay.sharedAvailableGb === null
@@ -442,7 +573,7 @@ function FloatingMonitorPanel({
<span className="block font-medium text-muted-foreground">
{t("settings.resources.gpu.ggufInference")}
</span>
- <span className="block font-mono text-foreground">
+ <span className="block text-foreground">
{separateInferenceGpu.backend?.toUpperCase() ?? "GPU"}
{separateInferenceGpu.available ? (
inferenceVramTotal ? (
@@ -470,27 +601,13 @@ function FloatingMonitorPanel({
</span>
</div>
)}
- {cpuPercent !== null && (
- <div
- className="border-t border-border/60 pt-2"
- data-testid="floating-monitor-cpu"
- >
- <DetailBar
- label={t("settings.resources.liveMonitor.cpuLoad")}
- value={`${Math.round(cpuPercent)}%`}
- percent={cpuPercent}
- indicatorClassName={usageIndicatorClass(cpuPercent)}
- textClassName={usageTextClass(cpuPercent)}
- />
- </div>
- )}
{telemetryRows.map((row) => (
<div
key={row.key}
className="space-y-1.5 border-t border-border/60 pt-2"
data-testid="floating-monitor-gpu-details"
>
- <div className="truncate text-ui-11 font-medium font-mono">
+ <div className="truncate text-xs font-medium text-foreground">
{row.name}
</div>
{row.loadPct !== null && (
@@ -525,11 +642,11 @@ function FloatingMonitorPanel({
textClassName={usageTextClass(row.powerPct)}
/>
) : (
- <div className="flex justify-between gap-2 text-xs font-mono text-muted-foreground">
+ <div className="flex justify-between gap-2 text-xs text-muted-foreground">
<span className="truncate">
{t("settings.resources.liveMonitor.power")}
</span>
- <span className="shrink-0 tabular-nums text-primary">
+ <span className="shrink-0 font-mono tabular-nums text-primary">
{formatPower(row.powerDrawW, null)}
</span>
</div>
@@ -632,11 +749,18 @@ export function FloatingMonitor() {
monitorWidth,
uiSpaceScale,
});
- const systemInfo = useSystemInfo({ enabled: visible, pollMs: 5000 });
+ const refreshMs = useMonitorOverlayStore((state) =>
+ monitorRefreshMs(state.refreshMs),
+ );
+ const systemInfo = useSystemInfo({
+ enabled: visible,
+ pollMs: refreshMs,
+ gpuFollowsPoll: true,
+ });
const [panelKey, setPanelKey] = useState(0);
const wasOpenRef = useRef(isOpen);
- // Advance the key on close so reopening mid-exit mounts fresh native resize geometry.
+ // Advance the key on close so reopening mid-exit mounts a fresh panel.
useEffect(() => {
if (wasOpenRef.current && !isOpen) {
setPanelKey((current) => current + 1);
diff --git a/studio/frontend/src/components/monitor-cards.ts b/studio/frontend/src/components/monitor-cards.ts
new file mode 100644
index 00000000000..2d1655254d6
--- /dev/null
+++ b/studio/frontend/src/components/monitor-cards.ts
@@ -0,0 +1,67 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
+
+import {
+ gpuMemoryTotalsGb,
+ resolveGpuVramUsedGb,
+ sharesHostMemoryDevice,
+ type VramReportingGpu,
+} from "../hooks/gpu-vram.ts";
+import type { GpuDevice } from "../hooks/use-system.ts";
+
+export interface CardUsage {
+ key: string;
+ label: string;
+ name: string;
+ title: string;
+ usedGb: number | null;
+ totalGb: number;
+}
+
+const VENDOR_PREFIX = /^(?:AMD\s+Radeon(?:\(TM\))?|NVIDIA(?:\s+GeForce)?|Intel(?:\(R\))?\s+Arc(?:\(TM\))?)\s+/i;
+
+export function shortCardName(name: string | undefined): string {
+ if (!name) return "GPU";
+ return name.replace(VENDOR_PREFIX, "") || name;
+}
+
+export interface VramCards {
+ cards: GpuDevice[];
+ totalGb: number;
+ /** null = unknown: one card without a reading must not read as 0. */
+ usedGb: number | null;
+ rows: CardUsage[];
+ showTotal: boolean;
+}
+
+/** Dedicated cards only: an iGPU borrows system RAM, and its missing reading would blank the total. */
+export function vramCards(
+ devices: GpuDevice[],
+ usageGpu: VramReportingGpu | null | undefined,
+): VramCards {
+ const dedicated = devices.filter((device) => !sharesHostMemoryDevice(device));
+ const cards = dedicated.length > 0 ? dedicated : devices;
+ const usedGb =
+ cards.length === devices.length
+ ? resolveGpuVramUsedGb(usageGpu)
+ : resolveGpuVramUsedGb({ devices: cards });
+ const rows =
+ cards.length > 1
+ ? cards.map((card, position) => ({
+ key: `${card.index ?? position}`,
+ // The ordinal the detail rows and Settings use, so a masked device keeps one name.
+ label: `GPU ${card.visible_ordinal ?? card.index ?? position}`,
+ name: shortCardName(card.name),
+ title: card.name ?? "GPU",
+ usedGb: Number.isFinite(card.vram_used_gb) ? (card.vram_used_gb as number) : null,
+ totalGb: gpuMemoryTotalsGb([card]).total,
+ }))
+ : [];
+ const showTotal =
+ rows.length === 0 || (usedGb !== null && rows.some((row) => row.usedGb === null));
+ return { cards, totalGb: gpuMemoryTotalsGb(cards).total, usedGb, rows, showTotal };
+}
+
+export function holdsModelsInVram(cards: readonly GpuDevice[]): boolean {
+ return cards.some((card) => card.shared_memory !== true && card.unified_memory !== true);
+}
diff --git a/studio/frontend/src/components/monitor-details.ts b/studio/frontend/src/components/monitor-details.ts
index 937c563aaea..78088f783c7 100644
--- a/studio/frontend/src/components/monitor-details.ts
+++ b/studio/frontend/src/components/monitor-details.ts
@@ -4,7 +4,6 @@
import type { GpuDevice } from "../hooks/use-system.ts";
export const MONITOR_DETAIL_METRICS = [
- "cpuLoad",
"gpuLoad",
"temperature",
"power",
@@ -96,8 +95,13 @@ export function formatTemperature(celsius: number): string {
return `${Math.round(celsius)}°C`;
}
+// An idle Apple GPU really draws under 1 W; "0 W" reads as a broken sensor, so keep a decimal there.
+function watts(value: number): string {
+ return value < 10 ? value.toFixed(1) : String(Math.round(value));
+}
+
export function formatPower(drawW: number, limitW: number | null): string {
return limitW !== null && limitW > 0
- ? `${Math.round(drawW)} / ${Math.round(limitW)} W`
- : `${Math.round(drawW)} W`;
+ ? `${watts(drawW)} / ${Math.round(limitW)} W`
+ : `${watts(drawW)} W`;
}
diff --git a/studio/frontend/src/components/monitor-loaded-models.tsx b/studio/frontend/src/components/monitor-loaded-models.tsx
new file mode 100644
index 00000000000..2fc136151f3
--- /dev/null
+++ b/studio/frontend/src/components/monitor-loaded-models.tsx
@@ -0,0 +1,17 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
+
+import { useLoadedModels } from "@/features/loaded-models/use-loaded-models";
+import type { LoadedModelEntry } from "@/features/loaded-models";
+import { useEffect } from "react";
+
+/** Lazy: keeps the chat runtime out of the startup graph. */
+export default function MonitorLoadedModels({
+ onEntries,
+}: {
+ onEntries: (entries: LoadedModelEntry[]) => void;
+}) {
+ const { polledEntries } = useLoadedModels(true, true);
+ useEffect(() => onEntries(polledEntries), [onEntries, polledEntries]);
+ return null;
+}
diff --git a/studio/frontend/src/components/monitor-memory.tsx b/studio/frontend/src/components/monitor-memory.tsx
new file mode 100644
index 00000000000..013c21f7a31
--- /dev/null
+++ b/studio/frontend/src/components/monitor-memory.tsx
@@ -0,0 +1,145 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
+
+import { Progress } from "@/components/ui/progress";
+import { useT } from "@/i18n";
+import { cn } from "@/lib/utils";
+import type { ReactNode } from "react";
+import {
+ STORAGE_COLORS,
+ StorageBar,
+ type StorageSegment,
+} from "@/features/settings/components/storage-overview";
+import type { MemorySegment } from "./monitor-share";
+
+export function usageIndicatorClass(percent: number): string {
+ if (percent >= 90) return "bg-destructive";
+ if (percent >= 70) return "bg-amber-500";
+ return "bg-control-accent";
+}
+
+export function usageTextClass(percent: number): string {
+ if (percent >= 90) return "text-destructive";
+ if (percent >= 70) return "text-amber-600 dark:text-amber-400";
+ return "text-primary";
+}
+
+export function formatGiB(value: number): string {
+ // Backend reports binary units (bytes / 1024**3), so label GiB.
+ return `${value.toFixed(value >= 10 ? 1 : 2)} GiB`;
+}
+
+export function MeterRow({
+ label,
+ readout,
+ readoutClassName,
+ children,
+ footer,
+ testId,
+}: {
+ label: ReactNode;
+ readout: string;
+ readoutClassName?: string;
+ children: ReactNode;
+ footer?: ReactNode;
+ testId?: string;
+}) {
+ return (
+ <div className="space-y-1.5" data-testid={testId}>
+ <div className="flex items-baseline justify-between gap-2 text-xs">
+ <span className="min-w-0 truncate font-medium text-foreground">{label}</span>
+ <span
+ className={cn(
+ "shrink-0 font-mono tabular-nums text-muted-foreground",
+ readoutClassName,
+ )}
+ >
+ {readout}
+ </span>
+ </div>
+ {children}
+ {footer && (
+ <div className="space-y-0.5 text-ui-11 text-muted-foreground">{footer}</div>
+ )}
+ </div>
+ );
+}
+
+export function UsageBar({ percent }: { percent: number | null }) {
+ return (
+ <Progress
+ value={percent ?? 0}
+ className="h-1.5 rounded-full bg-muted"
+ indicatorClassName={usageIndicatorClass(percent ?? 0)}
+ />
+ );
+}
+
+// Settings' storage palette, read inside a function: a module-scope read can hit the chat import cycle.
+function segmentColor(kind: MemorySegment["kind"], modelIndex: number): string {
+ switch (kind) {
+ case "model":
+ return [
+ STORAGE_COLORS.yellow,
+ STORAGE_COLORS.orange,
+ STORAGE_COLORS.green,
+ STORAGE_COLORS.blue,
+ ][Math.min(modelIndex, 3)];
+ case "unsloth":
+ return STORAGE_COLORS.yellow;
+ case "app":
+ return STORAGE_COLORS.purple;
+ case "free":
+ return STORAGE_COLORS.free;
+ default:
+ return STORAGE_COLORS.other;
+ }
+}
+
+export function MemoryShareBar({
+ segments,
+ noModels = false,
+}: {
+ segments: MemorySegment[];
+ noModels?: boolean;
+}) {
+ const t = useT();
+ const label = (segment: MemorySegment) => {
+ switch (segment.kind) {
+ case "model":
+ return segment.name ?? "";
+ case "app":
+ return t("settings.resources.liveMonitor.unslothApp");
+ case "unsloth":
+ return t("settings.resources.liveMonitor.unsloth");
+ case "other":
+ return t("settings.resources.liveMonitor.otherApps");
+ case "unattributed":
+ return t("settings.resources.liveMonitor.otherInUse");
+ case "free":
+ return t("settings.resources.liveMonitor.freeLabel");
+ }
+ };
+ let model = 0;
+ const storageSegments: StorageSegment[] = segments.map((segment) => ({
+ key: segment.id,
+ label: label(segment),
+ bytes: segment.gb,
+ value: formatGiB(segment.gb),
+ color: segmentColor(segment.kind, segment.kind === "model" ? model++ : 0),
+ }));
+ return (
+ <div className="space-y-1.5" data-testid="monitor-share-bar">
+ <StorageBar
+ segments={storageSegments}
+ legend="inline"
+ barClassName="h-1.5 rounded-full"
+ />
+ {noModels && (
+ <div className="text-ui-11 text-muted-foreground" data-testid="monitor-no-models">
+ {t("settings.resources.liveMonitor.noModelLoaded")}
+ </div>
+ )}
+ </div>
+ );
+}
diff --git a/studio/frontend/src/components/monitor-refresh.ts b/studio/frontend/src/components/monitor-refresh.ts
new file mode 100644
index 00000000000..1fd83810357
--- /dev/null
+++ b/studio/frontend/src/components/monitor-refresh.ts
@@ -0,0 +1,11 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
+
+export const MONITOR_REFRESH_OPTIONS_MS = [1000, 2000, 5000, 10000] as const;
+export const DEFAULT_MONITOR_REFRESH_MS = 5000;
+
+export function monitorRefreshMs(value: unknown): number {
+ return MONITOR_REFRESH_OPTIONS_MS.includes(value as never)
+ ? (value as number)
+ : DEFAULT_MONITOR_REFRESH_MS;
+}
diff --git a/studio/frontend/src/components/monitor-share.ts b/studio/frontend/src/components/monitor-share.ts
new file mode 100644
index 00000000000..0417a388234
--- /dev/null
+++ b/studio/frontend/src/components/monitor-share.ts
@@ -0,0 +1,205 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
+
+export interface MemoryShare {
+ unsloth: number;
+ other: number;
+ free: number;
+}
+
+export interface ModelShare {
+ id: string;
+ name: string;
+ gb: number;
+ measured?: boolean;
+}
+
+export interface ModelBreakdown {
+ models: ModelShare[];
+ /** Null when RSS cannot tell the app apart from the models. */
+ app: number | null;
+}
+
+const MIB_PER_GIB = 1024;
+
+export function memoryShare(
+ usedGb: number,
+ totalGb: number,
+ unslothGb: number | null,
+): MemoryShare | null {
+ if (!(totalGb > 0) || unslothGb === null || !Number.isFinite(unslothGb)) {
+ return null;
+ }
+ const used = Math.min(Math.max(0, usedGb), totalGb);
+ const unsloth = Math.min(Math.max(0, unslothGb), used);
+ return { unsloth, other: used - unsloth, free: totalGb - used };
+}
+
+/** llama.cpp's inference GPUs share no backend with the displayed ones ("cuda+vulkan" includes "cuda"). */
+export function inferenceGpuDisjoint(
+ systemBackend: string | null | undefined,
+ inferenceBackend: string | null | undefined,
+): boolean {
+ if (!systemBackend || !inferenceBackend) return false;
+ return !inferenceBackend.split("+").includes(systemBackend);
+}
+
+/** `gpuOnly`: only models known to sit on the displayed GPUs. */
+export function modelShares(
+ entries: readonly {
+ id: string;
+ name: string;
+ label?: string;
+ source?: string;
+ residentMib?: number;
+ residentOnGpu?: boolean;
+ }[],
+ gpuOnly = false,
+ inferenceGpuElsewhere = false,
+): ModelShare[] {
+ return entries
+ .filter(
+ (entry) =>
+ (entry.residentMib ?? 0) > 0 &&
+ (!gpuOnly ||
+ (entry.residentOnGpu === true &&
+ !(inferenceGpuElsewhere && entry.source === "chat"))),
+ )
+ .map((entry) => ({
+ id: entry.id,
+ name: entry.label || entry.name.split("/").pop() || entry.name,
+ gb: (entry.residentMib ?? 0) / MIB_PER_GIB,
+ ...(entry.source === "chat" ? { measured: true } : {}),
+ }))
+ .sort((a, b) => b.gb - a.gb);
+}
+
+/** Metal buffers can miss RSS on Apple, so the models' own size is the floor. */
+export function unslothPoolGb(
+ processGb: number | null,
+ modelsGb: number,
+ modelsInPool: boolean,
+): number | null {
+ if (processGb === null || !Number.isFinite(processGb)) return null;
+ return modelsInPool ? Math.max(processGb, modelsGb) : processGb;
+}
+
+export function modelBreakdown(
+ unslothGb: number | null,
+ models: ModelShare[],
+ modelsInPool: boolean,
+): ModelBreakdown {
+ if (unslothGb === null || !Number.isFinite(unslothGb)) {
+ return { models, app: null };
+ }
+ const inPool = modelsInPool ? models.reduce((sum, model) => sum + model.gb, 0) : 0;
+ const app = unslothGb - inPool;
+ return { models, app: app >= 0.01 ? app : null };
+}
+
+export interface MemorySegment {
+ id: string;
+ /** "unattributed": in use, owner unknown (VRAM, where only model weights are measured). */
+ kind: "model" | "app" | "unsloth" | "other" | "unattributed" | "free";
+ name?: string;
+ gb: number;
+}
+
+export function memorySegments(
+ share: MemoryShare,
+ breakdown: ModelBreakdown | null,
+ /** False on VRAM: the rest may be Unsloth's own KV cache or a training run, not other apps. */
+ restIsOtherApps = true,
+): MemorySegment[] {
+ const parts = breakdown && breakdown.models.length > 0
+ ? [
+ ...breakdown.models.map((model) => ({
+ id: `model:${model.id}`,
+ kind: "model" as const,
+ name: model.name,
+ gb: model.gb,
+ measured: model.measured === true,
+ })),
+ ...(breakdown.app !== null
+ ? [{ id: "app", kind: "app" as const, gb: breakdown.app, measured: false }]
+ : []),
+ ]
+ : null;
+ // Status can be fresher than the memory sample: shrink estimates before measured rows to fit.
+ const sum = (list: { gb: number }[]) => list.reduce((total, part) => total + part.gb, 0);
+ const exactGb = sum(parts?.filter((part) => part.measured) ?? []);
+ const restGb = sum(parts?.filter((part) => !part.measured) ?? []);
+ const fit = (gb: number, room: number) => (gb > room && gb > 0 ? Math.max(0, room) / gb : 1);
+ const exactScale = fit(exactGb, share.unsloth);
+ const restScale = fit(restGb, share.unsloth - exactGb * exactScale);
+ const unsloth: MemorySegment[] = parts
+ ? parts.map(({ measured, ...part }) => ({
+ ...part,
+ gb: part.gb * (measured ? exactScale : restScale),
+ }))
+ : [{ id: "unsloth", kind: "unsloth", gb: share.unsloth }];
+ return [
+ ...unsloth,
+ { id: "other", kind: restIsOtherApps ? "other" : "unattributed", gb: share.other },
+ { id: "free", kind: "free", gb: share.free },
+ ];
+}
+
+export interface PoolSplitInput {
+ entries: Parameters<typeof modelShares>[0];
+ showShare: boolean;
+ showBreakdown: boolean;
+ modelsInVram: boolean;
+ inferenceGpuElsewhere: boolean;
+ processGb: number | null;
+ ramUsedGb: number;
+ ramTotalGb: number;
+ vramUsedGb: number | null;
+ vramTotalGb: number;
+}
+
+export interface PoolSplit {
+ ram: MemorySegment[] | null;
+ vram: MemorySegment[] | null;
+ noModels: boolean;
+}
+
+export function poolSplit(input: PoolSplitInput): PoolSplit {
+ const { showShare, showBreakdown, modelsInVram } = input;
+ if (!showShare && !showBreakdown) return { ram: null, vram: null, noModels: false };
+ const sum = (list: ModelShare[]) => list.reduce((total, model) => total + model.gb, 0);
+ // On a GPU host each model goes to the pool it sits in; a proven CPU model stays in RAM.
+ const vramModels = modelsInVram
+ ? modelShares(input.entries, true, input.inferenceGpuElsewhere)
+ : [];
+ const ramModels = modelShares(
+ modelsInVram ? input.entries.filter((entry) => entry.residentOnGpu === false) : input.entries,
+ );
+ const unslothRamGb = unslothPoolGb(input.processGb, sum(ramModels), true);
+ const ramBreakdown =
+ showBreakdown && (!modelsInVram || ramModels.length > 0)
+ ? modelBreakdown(unslothRamGb, ramModels, true)
+ : null;
+ const ramShare =
+ showShare || ramBreakdown
+ ? memoryShare(input.ramUsedGb, input.ramTotalGb, unslothRamGb)
+ : null;
+ // An unsized or unknown-pool model would read as Unsloth holding 0 GiB of VRAM.
+ const unsized = input.entries.some(
+ (entry) =>
+ !((entry.residentMib ?? 0) > 0) ||
+ (typeof entry.residentOnGpu !== "boolean" &&
+ !(input.inferenceGpuElsewhere && entry.source === "chat")),
+ );
+ const vramShare =
+ modelsInVram && !unsized && input.vramUsedGb !== null
+ ? memoryShare(input.vramUsedGb, input.vramTotalGb, sum(vramModels))
+ : null;
+ return {
+ ram: ramShare && memorySegments(ramShare, ramBreakdown),
+ vram:
+ vramShare &&
+ memorySegments(vramShare, showBreakdown ? { models: vramModels, app: null } : null, false),
+ noModels: showBreakdown && input.entries.length === 0,
+ };
+}
diff --git a/studio/frontend/src/features/chat/types/api.ts b/studio/frontend/src/features/chat/types/api.ts
index e538f6e795a..54f47d42634 100644
--- a/studio/frontend/src/features/chat/types/api.ts
+++ b/studio/frontend/src/features/chat/types/api.ts
@@ -378,6 +378,7 @@ export interface InferenceStatusResponse {
serving?: string[];
serving_checkpoints?: string[];
resident_mib?: number | null;
+ resident_on_gpu?: boolean | null;
/** Keep multiple models loaded, as saved on the server. Absent from older servers. */
multi_model_mode?: "off" | "fit" | "always";
inference?: {
diff --git a/studio/frontend/src/features/loaded-models/loaded-models-api.ts b/studio/frontend/src/features/loaded-models/loaded-models-api.ts
index 321c8c67d72..f250eff00d4 100644
--- a/studio/frontend/src/features/loaded-models/loaded-models-api.ts
+++ b/studio/frontend/src/features/loaded-models/loaded-models-api.ts
@@ -37,6 +37,7 @@ import {
mergeLoadedModels,
sttEngineStatus,
verifyResident,
+ withServingResident,
} from "./loaded-models-sources";
type InferenceStatus = NonNullable<
@@ -45,8 +46,10 @@ type InferenceStatus = NonNullable<
async function readInferenceStatus(
signal?: AbortSignal,
+ model?: string,
): Promise<InferenceStatus | null> {
- const response = await authFetch("/api/inference/status", { signal });
+ const query = model ? `?model=${encodeURIComponent(model)}` : "";
+ const response = await authFetch(`/api/inference/status${query}`, { signal });
if (!response.ok) return null;
return (await response.json()) as InferenceStatus;
}
@@ -120,7 +123,7 @@ export async function readLoadedModels(
): Promise<LoadedModelsRead> {
const owner = isAccountOwner();
const [inference, diffusion, video, stt, embedding] = await Promise.all([
- settled(readInferenceStatus),
+ settled((signal) => readInferenceStatus(signal)),
settled(getDiffusionStatus),
settled(getVideoStatus),
settled(readSttStatus),
@@ -138,8 +141,21 @@ export async function readLoadedModels(
unreadable.push(source);
return kept(source);
};
+ // /status sizes only the primary slot; each kept model is asked for on its own.
+ const chat = await Promise.all(
+ group("chat", inference, describeInferenceStatus).map(async (entry) =>
+ entry.servingCheckpoint
+ ? withServingResident(
+ entry,
+ await settled((signal) =>
+ readInferenceStatus(signal, entry.servingCheckpoint),
+ ),
+ )
+ : entry,
+ ),
+ );
const entries = mergeLoadedModels([
- group("chat", inference, describeInferenceStatus),
+ chat,
group("image", diffusion, describeDiffusionStatus),
group("video", video, describeVideoStatus),
group("stt", stt, describeSttStatus),
diff --git a/studio/frontend/src/features/loaded-models/loaded-models-sources.ts b/studio/frontend/src/features/loaded-models/loaded-models-sources.ts
index 8752af91f0d..5144a6f2de4 100644
--- a/studio/frontend/src/features/loaded-models/loaded-models-sources.ts
+++ b/studio/frontend/src/features/loaded-models/loaded-models-sources.ts
@@ -46,6 +46,7 @@ export type LoadedModelEntry = {
label?: string;
servingCheckpoint?: string;
residentMib?: number;
+ residentOnGpu?: boolean;
/** One short line: quantisation, family, device. */
detail: string;
/** Only on a `tts` row: the Audio page workflows that run the model, first one first. */
@@ -244,6 +245,7 @@ export function describeInferenceStatus(
status.is_vision ? "Vision" : null,
),
...residentMib(status.resident_mib),
+ ...(typeof status.resident_on_gpu === "boolean" ? { residentOnGpu: status.resident_on_gpu } : {}),
});
}
// /status reports the whole load, so loads started in another tab still show.
@@ -298,6 +300,23 @@ export function describeInferenceStatus(
return entries;
}
+export function withServingResident(
+ entry: LoadedModelEntry,
+ status: InferenceStatusResponse | null,
+): LoadedModelEntry {
+ if (!status || !entry.servingCheckpoint) return entry;
+ // By checkpoint when known: the primary wins a routing tie and may share this row's label.
+ const answered = status.model_identifier
+ ? status.model_identifier === entry.servingCheckpoint
+ : status.active_model === entry.name;
+ if (!answered) return entry;
+ return {
+ ...entry,
+ ...residentMib(status.resident_mib),
+ ...(typeof status.resident_on_gpu === "boolean" ? { residentOnGpu: status.resident_on_gpu } : {}),
+ };
+}
+
/** Unrecognised values are shown upper-cased, which keeps quants like "Q8_0" readable. */
export function precisionLabel(value: string | null | undefined): string | null {
if (!value || value === "none") return null;
@@ -336,6 +355,7 @@ export function describeDiffusionStatus(
name: status.repo_id,
...(status.display_repo_id ? { label: status.display_repo_id } : {}),
...residentMib(status.resident_mib),
+ ...(status.device ? { residentOnGpu: status.device !== "cpu" } : {}),
detail: joinDetail(
status.family,
// Only when the GGUF ran: a dense fast path replaces it with a torchao build.
@@ -363,6 +383,7 @@ export function describeVideoStatus(
name: status.repo_id,
...(status.display_repo_id ? { label: status.display_repo_id } : {}),
...residentMib(status.resident_mib),
+ ...(status.device ? { residentOnGpu: status.device !== "cpu" } : {}),
detail: joinDetail(
status.family,
status.model_kind === "gguf" || status.gguf_variant ? "GGUF" : null,
@@ -549,6 +570,7 @@ export function sameLoadedModels(
entry.sttEngine === other.sttEngine &&
entry.servingCheckpoint === other.servingCheckpoint &&
entry.residentMib === other.residentMib &&
+ entry.residentOnGpu === other.residentOnGpu &&
(entry.workflows ?? []).join() === (other.workflows ?? []).join()
);
});
diff --git a/studio/frontend/src/features/settings/settings-search.ts b/studio/frontend/src/features/settings/settings-search.ts
index 1afc4bcfa61..04ceb208bdd 100644
--- a/studio/frontend/src/features/settings/settings-search.ts
+++ b/studio/frontend/src/features/settings/settings-search.ts
@@ -117,6 +117,9 @@ export const SETTINGS_SEARCH_INDEX: Record<SettingsTab, TranslationKey[]> = {
"settings.resources.liveMonitor.ram",
"settings.resources.liveMonitor.vram",
"settings.resources.liveMonitor.disk",
+ "settings.resources.liveMonitor.refreshRate",
+ "settings.resources.liveMonitor.unslothShare",
+ "settings.resources.liveMonitor.modelBreakdown",
"settings.resources.gpu.title",
"settings.resources.modelMemory.title",
"settings.resources.modelMemory.keepResident",
diff --git a/studio/frontend/src/features/settings/stores/monitor-overlay-store.ts b/studio/frontend/src/features/settings/stores/monitor-overlay-store.ts
index e89452c5ff0..d65315adb83 100644
--- a/studio/frontend/src/features/settings/stores/monitor-overlay-store.ts
+++ b/studio/frontend/src/features/settings/stores/monitor-overlay-store.ts
@@ -9,6 +9,10 @@ import {
type MonitorDetailMetric,
selectedDetailMetrics,
} from "@/components/monitor-details";
+import {
+ DEFAULT_MONITOR_REFRESH_MS,
+ monitorRefreshMs,
+} from "@/components/monitor-refresh";
interface MonitorOverlayState {
isOpen: boolean;
@@ -16,10 +20,16 @@ interface MonitorOverlayState {
/** Off by default: the monitor looks as it always has until a user opts in. */
showDetails: boolean;
detailMetrics: MonitorDetailMetric[];
+ refreshMs: number;
setIsOpen: (open: boolean) => void;
toggleMinimized: () => void;
setShowDetails: (show: boolean) => void;
+ showUnslothShare: boolean;
+ setShowUnslothShare: (show: boolean) => void;
+ showModelBreakdown: boolean;
+ setShowModelBreakdown: (show: boolean) => void;
setDetailMetric: (metric: MonitorDetailMetric, on: boolean) => void;
+ setRefreshMs: (ms: number) => void;
}
export const useMonitorOverlayStore = create<MonitorOverlayState>()(
@@ -28,10 +38,15 @@ export const useMonitorOverlayStore = create<MonitorOverlayState>()(
isOpen: false,
isMinimized: false,
showDetails: false,
+ showUnslothShare: false,
+ showModelBreakdown: false,
detailMetrics: [...MONITOR_DETAIL_METRICS],
+ refreshMs: DEFAULT_MONITOR_REFRESH_MS,
setIsOpen: (isOpen) => set({ isOpen }),
toggleMinimized: () => set((state) => ({ isMinimized: !state.isMinimized })),
setShowDetails: (showDetails) => set({ showDetails }),
+ setShowUnslothShare: (showUnslothShare) => set({ showUnslothShare }),
+ setShowModelBreakdown: (showModelBreakdown) => set({ showModelBreakdown }),
setDetailMetric: (metric, on) =>
set((state) => {
const current = selectedDetailMetrics(state.detailMetrics);
@@ -41,6 +56,7 @@ export const useMonitorOverlayStore = create<MonitorOverlayState>()(
),
};
}),
+ setRefreshMs: (ms) => set({ refreshMs: monitorRefreshMs(ms) }),
}),
{ name: "unsloth_monitor_overlay" }
)
diff --git a/studio/frontend/src/features/settings/tabs/resources-tab.tsx b/studio/frontend/src/features/settings/tabs/resources-tab.tsx
index 8b54dbe46aa..8ee87fc549e 100644
--- a/studio/frontend/src/features/settings/tabs/resources-tab.tsx
+++ b/studio/frontend/src/features/settings/tabs/resources-tab.tsx
@@ -42,7 +42,7 @@ import { openLink } from "@/lib/open-link";
import { toast } from "@/lib/toast";
import { cn } from "@/lib/utils";
import { useT } from "@/i18n";
-import { useEffect, useMemo, useRef, useState } from "react";
+import { type ReactNode, useEffect, useMemo, useRef, useState } from "react";
import {
type HuggingFaceCacheSettings,
loadHuggingFaceCacheSettings,
@@ -69,7 +69,22 @@ import {
type StorageSegment,
StorageOverview,
} from "../components/storage-overview";
+import {
+ MONITOR_REFRESH_OPTIONS_MS,
+ monitorRefreshMs,
+} from "@/components/monitor-refresh";
import { useMonitorOverlayStore } from "../stores/monitor-overlay-store";
+import { MemoryShareBar } from "@/components/monitor-memory";
+import { inferenceGpuDisjoint, poolSplit } from "@/components/monitor-share";
+import { useLoadedModels } from "@/features/loaded-models/use-loaded-models";
+import { holdsModelsInVram, vramCards } from "@/components/monitor-cards";
+import {
+ Select,
+ SelectContent,
+ SelectItem,
+ SelectTrigger,
+ SelectValue,
+} from "@/components/ui/select";
import { useSettingsPanelPrefsStore } from "../stores/settings-panel-prefs-store";
import { ArrowUpRight01Icon } from "@hugeicons/core-free-icons";
import { HugeiconsIcon } from "@hugeicons/react";
@@ -148,14 +163,16 @@ function MetricTile({
percent,
showUsage = true,
extraDetail,
+ children,
}: {
label: string;
value: string;
- detail: string;
+ detail?: string;
// null = unknown (e.g. Windows ROCm perf counter); show a dash, not 0%.
percent: number | null;
showUsage?: boolean;
extraDetail?: string;
+ children?: ReactNode;
}) {
const percentKnown = isFiniteNumber(percent);
const safePercent = clampPercent(percent);
@@ -186,12 +203,14 @@ function MetricTile({
>
{value}
</span>
- <span
- title={detail}
- className="truncate text-ui-11 text-muted-foreground"
- >
- {detail}
- </span>
+ {detail ? (
+ <span
+ title={detail}
+ className="truncate text-ui-11 text-muted-foreground"
+ >
+ {detail}
+ </span>
+ ) : null}
{extraDetail ? (
<span className="whitespace-pre-line text-ui-11 text-muted-foreground">
{extraDetail}
@@ -206,6 +225,7 @@ function MetricTile({
indicatorClassName={usageIndicatorClass(safePercent)}
/>
)}
+ {children ? <div className="mt-auto">{children}</div> : null}
</div>
);
}
@@ -293,7 +313,18 @@ export function ResourcesTab() {
setShowDetails,
detailMetrics: storedDetailMetrics,
setDetailMetric,
+ refreshMs,
+ setRefreshMs,
+ showUnslothShare,
+ setShowUnslothShare,
+ showModelBreakdown,
+ setShowModelBreakdown,
} = useMonitorOverlayStore();
+ const wantsModels = showUnslothShare || showModelBreakdown;
+ const { polledEntries: loadedModels } = useLoadedModels(
+ wantsModels,
+ wantsModels,
+ );
const detailMetrics = selectedDetailMetrics(storedDetailMetrics);
// always fetch once: the switch is persisted now, so gating the hook on it
// would leave a session that opens with it off reading zeros forever.
@@ -611,6 +642,31 @@ export function ResourcesTab() {
shared: formatGiB(metrics.vramShared),
})
: formatGiB(unifiedPool ? metrics.vramShared : metrics.vramTotal);
+ const vram = vramCards(memoryDisplay.usageDevices, memoryDisplay.usageGpu);
+ const discreteVram =
+ hasGpu &&
+ !unifiedPool &&
+ !memoryDisplay.sharedOnly &&
+ holdsModelsInVram(vram.cards);
+ const processMb =
+ systemInfo.memory?.process_tree_used_mb ?? systemInfo.memory?.process_used_mb;
+ const split = poolSplit({
+ entries: loadedModels,
+ showShare: showUnslothShare,
+ showBreakdown: showModelBreakdown,
+ modelsInVram: discreteVram,
+ inferenceGpuElsewhere: inferenceGpuDisjoint(
+ systemInfo.gpu?.backend,
+ separateInferenceGpu?.backend,
+ ),
+ processGb: !hostUnread && processMb !== undefined ? processMb / 1024 : null,
+ ramUsedGb: metrics.ramUsed,
+ ramTotalGb: metrics.ramTotal,
+ vramUsedGb: vram.usedGb,
+ vramTotalGb: vram.totalGb,
+ });
+ const ramSegments = split.ram;
+ const vramSegments = split.vram;
// The placeholder's cpu backend and empty package list are not facts about the host either.
const hostReading = (value: string) => (hostUnread ? unknownLabel : value);
// systemInfo.gpu, not displayedGpu: a Vulkan llama.cpp makes displayedGpu use the inference
@@ -725,7 +781,7 @@ export function ResourcesTab() {
)}
<MetricTile
label={t(
- memoryDisplay.sharedOnly
+ memoryDisplay.sharedOnly || unifiedPool
? "settings.resources.gpu.memory"
: "settings.resources.liveMonitor.vram",
)}
@@ -778,6 +834,63 @@ export function ResourcesTab() {
percent={metrics.vramUsageKnown ? metrics.vramPercent : null}
/>
</div>
+ {(ramSegments || vramSegments) && (
+ <div
+ className="grid gap-3 pb-3 sm:grid-cols-2 sm:[&>:last-child:nth-child(odd)]:col-span-2"
+ data-testid="settings-unsloth-share"
+ >
+ {ramSegments && (
+ <MetricTile
+ label={t(
+ unifiedPool
+ ? "settings.resources.liveMonitor.memory"
+ : "settings.resources.liveMonitor.ram",
+ )}
+ value={`${formatGiB(metrics.ramUsed)} / ${formatGiB(metrics.ramTotal)}`}
+ percent={null}
+ showUsage={false}
+ >
+ <MemoryShareBar
+ segments={ramSegments}
+ noModels={!discreteVram && split.noModels}
+ />
+ </MetricTile>
+ )}
+ {vramSegments && (
+ <MetricTile
+ label={t("settings.resources.liveMonitor.vram")}
+ value={`${formatGiB(vram.usedGb)} / ${formatGiB(vram.totalGb)}`}
+ percent={null}
+ showUsage={false}
+ >
+ <MemoryShareBar
+ segments={vramSegments}
+ noModels={split.noModels}
+ />
+ </MetricTile>
+ )}
+ </div>
+ )}
+ <SettingsRow
+ label={t("settings.resources.liveMonitor.unslothShare")}
+ description={t("settings.resources.liveMonitor.unslothShareDescription")}
+ >
+ <Switch
+ aria-label={t("settings.resources.liveMonitor.unslothShare")}
+ checked={showUnslothShare}
+ onCheckedChange={setShowUnslothShare}
+ />
+ </SettingsRow>
+ <SettingsRow
+ label={t("settings.resources.liveMonitor.modelBreakdown")}
+ description={t("settings.resources.liveMonitor.modelBreakdownDescription")}
+ >
+ <Switch
+ aria-label={t("settings.resources.liveMonitor.modelBreakdown")}
+ checked={showModelBreakdown}
+ onCheckedChange={setShowModelBreakdown}
+ />
+ </SettingsRow>
</SettingsSection>
<SettingsSection title={t("settings.resources.gpu.title")}>
@@ -1112,6 +1225,31 @@ export function ResourcesTab() {
onCheckedChange={setIsOpen}
/>
</SettingsRow>
+ <SettingsRow
+ label={t("settings.resources.liveMonitor.refreshRate")}
+ description={t("settings.resources.liveMonitor.refreshRateDescription")}
+ >
+ <Select
+ value={String(monitorRefreshMs(refreshMs))}
+ onValueChange={(value) => setRefreshMs(Number(value))}
+ >
+ <SelectTrigger
+ className="w-28"
+ aria-label={t("settings.resources.liveMonitor.refreshRate")}
+ >
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ {MONITOR_REFRESH_OPTIONS_MS.map((ms) => (
+ <SelectItem key={ms} value={String(ms)}>
+ {t("settings.resources.liveMonitor.refreshEvery", {
+ seconds: ms / 1000,
+ })}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ </SettingsRow>
<SettingsRow
label={t("settings.resources.liveMonitor.detailedView")}
description={t(
diff --git a/studio/frontend/src/hooks/floating-panel-position.ts b/studio/frontend/src/hooks/floating-panel-position.ts
index dfc1df7f937..41a2d88bad3 100644
--- a/studio/frontend/src/hooks/floating-panel-position.ts
+++ b/studio/frontend/src/hooks/floating-panel-position.ts
@@ -4,6 +4,7 @@
export const FLOATING_PANEL_POSITION_KEYS = {
liveMonitor: "unsloth_live_monitor_position",
apiMonitor: "unsloth_api_monitor_position",
+ liveMonitorWidth: "unsloth_live_monitor_width",
} as const;
/** User's drop spot in its constraints box; a null axis stays anchored to the far edge. */
@@ -102,3 +103,45 @@ export function snapsToAnchor(
Math.abs(drop.top - a.top) <= threshold;
return near(rest) || near(max);
}
+
+function clampWidth(value: number, min: number, max: number): number {
+ return Math.max(min, Math.min(max, value));
+}
+
+/** Width only: the height follows the content. */
+export interface PanelResizeOptions {
+ minWidth: number;
+ maxWidth: number;
+ /** The CSS width when none is chosen; a squeezed panel grows back to it. */
+ defaultWidth: () => number;
+ storageKey: string;
+}
+
+/** -1 left/top, 1 right/bottom, 0 not grabbed; `y` picks the edge that stays put. */
+export interface ResizeEdges {
+ x: -1 | 0 | 1;
+ y: -1 | 0 | 1;
+}
+
+export function readPanelWidth(
+ options: PanelResizeOptions | undefined,
+): number | null {
+ if (!options) return null;
+ try {
+ const value = Number(localStorage.getItem(options.storageKey));
+ return Number.isFinite(value) && value > 0
+ ? clampWidth(value, options.minWidth, options.maxWidth)
+ : null;
+ } catch {
+ return null;
+ }
+}
+
+export function resizedWidth(
+ session: { width: number; edges: ResizeEdges },
+ dx: number,
+ bounds: { min: number; max: number },
+): number {
+ const next = session.width + session.edges.x * dx;
+ return clampWidth(next, bounds.min, Math.max(bounds.min, bounds.max));
+}
diff --git a/studio/frontend/src/hooks/gpu-vram.ts b/studio/frontend/src/hooks/gpu-vram.ts
index 01d7670525f..8e2d1cedc49 100644
--- a/studio/frontend/src/hooks/gpu-vram.ts
+++ b/studio/frontend/src/hooks/gpu-vram.ts
@@ -29,7 +29,7 @@ export interface VramReportingGpu {
vram_used_gb_aggregate?: number | null;
}
-function sharesHostMemoryDevice(device: MemoryTotalDevice): boolean {
+export function sharesHostMemoryDevice(device: MemoryTotalDevice): boolean {
return sharesHostMemory({
sharedMemory: device.shared_memory === true,
unifiedMemory: device.unified_memory === true,
diff --git a/studio/frontend/src/hooks/use-floating-panel-layout.ts b/studio/frontend/src/hooks/use-floating-panel-layout.ts
index 9b54d12e042..a5fb36cf33f 100644
--- a/studio/frontend/src/hooks/use-floating-panel-layout.ts
+++ b/studio/frontend/src/hooks/use-floating-panel-layout.ts
@@ -5,6 +5,10 @@ import { useMonitorFrameStore } from "@/features/settings/stores/monitor-frame-s
import {
type FrameBox,
type PanelIntent,
+ type PanelResizeOptions,
+ type ResizeEdges,
+ readPanelWidth,
+ resizedWidth,
clearPanelIntent,
isDegenerateBox,
liftAboveObstacle,
@@ -85,6 +89,23 @@ function naturalWidth(monitor: HTMLDivElement): number {
return width;
}
+interface ResizeSession {
+ pointerId: number;
+ startX: number;
+ startY: number;
+ left: number;
+ top: number;
+ width: number;
+ height: number;
+ constraintsWidth: number;
+ constraintsHeight: number;
+ hx: -1 | 1;
+ vy: -1 | 1;
+ edges: ResizeEdges;
+ moved: boolean;
+ last: { width: number; left: number; top: number };
+}
+
export function useFloatingPanelLayout(
constraintsElement: HTMLDivElement | null,
narrowed: boolean,
@@ -95,6 +116,7 @@ export function useFloatingPanelLayout(
) => { left: number; top: number },
storageKey?: string,
restingObstacle?: FrameBox | null,
+ resize?: PanelResizeOptions,
) {
// Per instance: a panel unmounting mid-exit clears only its own frame.
const publisher = useMemo(() => ({}), []);
@@ -102,7 +124,6 @@ export function useFloatingPanelLayout(
const scrollRef = useRef<HTMLDivElement>(null);
const contentRef = useRef<HTMLDivElement>(null);
const dragSessionRef = useRef<DragSession | null>(null);
- const dragFrameRef = useRef(0);
// User's spot, never rewritten by a clamp.
const [storedIntent] = useState(() => readPanelIntent(storageKey));
const intentRef = useRef<PanelIntent>(storedIntent ?? { left: null, top: null });
@@ -118,6 +139,13 @@ export function useFloatingPanelLayout(
const initializedRef = useRef(false);
const obstacleRef = useRef(restingObstacle ?? null);
const restRef = useRef({ left: 0, top: 0, maxLeft: 0, maxTop: 0 });
+ const resizeRef = useRef(resize);
+ const resizeSessionRef = useRef<ResizeSession | null>(null);
+ const [width, setWidth] = useState<number | null>(() => readPanelWidth(resize));
+ const widthRef = useRef(width);
+ if (resize) {
+ preferredWidthRef.current = resize.minWidth;
+ }
useLayoutEffect(() => {
const monitor = monitorRef.current;
@@ -131,7 +159,7 @@ export function useFloatingPanelLayout(
return;
}
surfaceWidthRef.current = surfaceWidth;
- if (monitor.style.width || remeasureRef.current) {
+ if (resizeRef.current || monitor.style.width || remeasureRef.current) {
return;
}
remeasureRef.current = requestAnimationFrame(() => {
@@ -155,7 +183,9 @@ export function useFloatingPanelLayout(
scheduleWidthRemeasure(constraintsBox.width);
const desiredWidth = Math.max(
- monitorBox.width,
+ resizeRef.current
+ ? (widthRef.current ?? resizeRef.current.defaultWidth())
+ : monitorBox.width,
preferredWidthRef.current ?? monitorBox.width,
);
@@ -171,6 +201,11 @@ export function useFloatingPanelLayout(
const maxLeft = Math.max(0, constraintsBox.width - width);
const maxTop = Math.max(0, constraintsBox.height - height);
const session = dragSessionRef.current;
+ if (resizeSessionRef.current) {
+ // Mid-resize the resize handler owns position; only refresh the content floor.
+ preferredHeightRef.current = desiredHeight;
+ return;
+ }
// Mid-drag the pointer owns the spot: the measured box can be a frame behind it.
let left = session
? clamp(session.left, 0, maxLeft)
@@ -270,10 +305,6 @@ export function useFloatingPanelLayout(
cancelAnimationFrame(remeasureRef.current);
remeasureRef.current = 0;
}
- if (dragFrameRef.current) {
- cancelAnimationFrame(dragFrameRef.current);
- dragFrameRef.current = 0;
- }
};
}, [constraintsElement, publisher, storedIntent]);
@@ -320,7 +351,12 @@ export function useFloatingPanelLayout(
function startDrag(event: PointerEvent<HTMLDivElement>) {
const monitor = monitorRef.current;
- if (event.button !== 0 || !(monitor && constraintsElement)) {
+ if (
+ event.button !== 0 ||
+ !(monitor && constraintsElement) ||
+ dragSessionRef.current ||
+ resizeSessionRef.current
+ ) {
return;
}
@@ -330,10 +366,11 @@ export function useFloatingPanelLayout(
const left = monitorBox.left - constraintsBox.left;
const top = monitorBox.top - constraintsBox.top;
- // Sync inline size where max-width/height clipped a native resize.
+ // Sync inline size where max-width/height clipped a native resize; a state-held width is left alone.
const inlineWidth = Number.parseFloat(monitor.style.width);
const inlineHeight = Number.parseFloat(monitor.style.height);
if (
+ !resizeRef.current &&
Number.isFinite(inlineWidth) &&
Math.abs(inlineWidth - monitorBox.width) > 0.5
) {
@@ -362,9 +399,8 @@ export function useFloatingPanelLayout(
event.currentTarget.setPointerCapture(event.pointerId);
}
- // One transform per frame: left/top moves re-sample the backdrop blur.
+ // A transform, never left/top: those re-layout and re-sample the backdrop blur.
function paintDrag() {
- dragFrameRef.current = 0;
const session = dragSessionRef.current;
const monitor = monitorRef.current;
if (!(session && monitor)) {
@@ -393,9 +429,8 @@ export function useFloatingPanelLayout(
0,
session.maxTop,
);
- if (!dragFrameRef.current) {
- dragFrameRef.current = requestAnimationFrame(paintDrag);
- }
+ // Paint now: a rAF left the card a frame behind a fast pointer.
+ paintDrag();
}
function finishDrag(event: PointerEvent<HTMLDivElement>) {
@@ -403,10 +438,6 @@ export function useFloatingPanelLayout(
if (session?.pointerId !== event.pointerId) {
return;
}
- if (dragFrameRef.current) {
- cancelAnimationFrame(dragFrameRef.current);
- dragFrameRef.current = 0;
- }
const {
left,
top,
@@ -486,7 +517,11 @@ export function useFloatingPanelLayout(
function nudge(event: KeyboardEvent<HTMLElement>): boolean {
const delta = nudgeDelta(event.key, event.shiftKey);
const monitor = monitorRef.current;
- if (!(delta && monitor && constraintsElement) || dragSessionRef.current) {
+ if (
+ !(delta && monitor && constraintsElement) ||
+ dragSessionRef.current ||
+ resizeSessionRef.current
+ ) {
return false;
}
event.preventDefault();
@@ -513,6 +548,137 @@ export function useFloatingPanelLayout(
return true;
}
+
+ function startResize(event: PointerEvent<HTMLElement>, edges: ResizeEdges) {
+ const monitor = monitorRef.current;
+ const options = resizeRef.current;
+ if (
+ event.button !== 0 ||
+ !(monitor && constraintsElement && options) ||
+ dragSessionRef.current ||
+ resizeSessionRef.current
+ ) {
+ return;
+ }
+ event.preventDefault();
+ event.stopPropagation();
+ const constraintsBox = constraintsElement.getBoundingClientRect();
+ const box = monitor.getBoundingClientRect();
+ const intent = intentRef.current;
+ resizeSessionRef.current = {
+ pointerId: event.pointerId,
+ startX: event.clientX,
+ startY: event.clientY,
+ left: box.left - constraintsBox.left,
+ top: box.top - constraintsBox.top,
+ width: box.width,
+ height: box.height,
+ constraintsWidth: constraintsBox.width,
+ constraintsHeight: constraintsBox.height,
+ hx: edges.x !== 0 ? edges.x : intent.left === null ? -1 : 1,
+ vy: edges.y !== 0 ? edges.y : intent.top === null ? -1 : 1,
+ edges,
+ moved: false,
+ last: {
+ width: box.width,
+ left: box.left - constraintsBox.left,
+ top: box.top - constraintsBox.top,
+ },
+ };
+ event.currentTarget.setPointerCapture(event.pointerId);
+ }
+
+ function updateResize(event: PointerEvent<HTMLElement>) {
+ const session = resizeSessionRef.current;
+ const monitor = monitorRef.current;
+ const options = resizeRef.current;
+ if (!(session && monitor && options) || session.pointerId !== event.pointerId) {
+ return;
+ }
+ const right = session.left + session.width;
+ const bottom = session.top + session.height;
+ const room = session.hx === -1 ? right : session.constraintsWidth - session.left;
+ const next = resizedWidth(session, event.clientX - session.startX, {
+ min: options.minWidth,
+ max: Math.min(options.maxWidth, room),
+ });
+ if (!session.moved && Math.abs(next - session.width) < 0.5) {
+ return;
+ }
+ session.moved = true;
+ const left = session.hx === -1 ? right - next : session.left;
+ // Write the node first: motion.div style lands a frame late, and text rewraps at the new width.
+ monitor.style.maxWidth = `${session.constraintsWidth - left}px`;
+ monitor.style.width = `${next}px`;
+ monitor.style.left = `${left}px`;
+ const height = desiredPanelHeight(
+ monitor.offsetHeight,
+ scrollRef.current,
+ contentRef.current,
+ );
+ const top = clamp(
+ session.vy === -1 ? bottom - height : session.top,
+ 0,
+ Math.max(0, session.constraintsHeight - height),
+ );
+ monitor.style.top = `${top}px`;
+ monitor.style.minHeight = `${height}px`;
+ monitor.style.maxHeight = `${session.constraintsHeight - top}px`;
+ session.last = { width: next, left, top };
+ widthRef.current = next;
+ setWidth(next);
+ setLayout((current) =>
+ current
+ ? {
+ ...current,
+ left,
+ top,
+ minHeight: height,
+ maxWidth: session.constraintsWidth - left,
+ maxHeight: session.constraintsHeight - top,
+ }
+ : current,
+ );
+ }
+
+ function finishResize(event: PointerEvent<HTMLElement>) {
+ const session = resizeSessionRef.current;
+ const options = resizeRef.current;
+ if (!(session && options) || session.pointerId !== event.pointerId) {
+ return;
+ }
+ resizeSessionRef.current = null;
+ // A click (or the double-click that resets) must not turn an anchored corner into a fixed spot.
+ if (session.moved) {
+ const { width: last, left, top } = session.last;
+ const previous = intentRef.current;
+ intentRef.current = {
+ left: previous.left === null && session.hx === -1 ? null : left,
+ top: previous.top === null && session.vy === -1 ? null : top,
+ };
+ storePanelIntent(storageKey, intentRef.current);
+ try {
+ localStorage.setItem(options.storageKey, String(Math.round(last)));
+ } catch {
+ // Storage blocked: the width still applies this session.
+ }
+ }
+ reconcileRef.current?.();
+ }
+
+ function resetWidth() {
+ const options = resizeRef.current;
+ if (!options) return;
+ try {
+ localStorage.removeItem(options.storageKey);
+ } catch {
+ // Nothing stored.
+ }
+ widthRef.current = null;
+ setWidth(null);
+ reconcileRef.current?.();
+ }
+
return {
publisher,
monitorRef,
@@ -524,5 +690,10 @@ export function useFloatingPanelLayout(
finishDrag,
resetPosition,
nudge,
+ width,
+ startResize,
+ updateResize,
+ finishResize,
+ resetWidth,
};
}
diff --git a/studio/frontend/src/hooks/use-system.ts b/studio/frontend/src/hooks/use-system.ts
index 95ddd5b6d2c..a168ffdf8e3 100644
--- a/studio/frontend/src/hooks/use-system.ts
+++ b/studio/frontend/src/hooks/use-system.ts
@@ -90,6 +90,7 @@ export interface SystemInfoResponse {
available_gb: number;
percent_used: number;
process_used_mb: number;
+ process_tree_used_mb?: number;
};
disk: {
total_gb: number;
@@ -115,6 +116,7 @@ export interface SystemInfoResponse {
let cachedSystem: SystemInfoResponse | null = null;
let systemFetchPromise: Promise<SystemInfoResponse | null> | null = null;
+let systemFetchGpuMaxAgeMs: number | undefined;
let systemFetchProbesMedia = false;
const systemSubscribers = new Set<(data: SystemInfoResponse) => void>();
let vulkanRetrySubscribers = 0;
@@ -208,33 +210,58 @@ function scheduleVulkanRetry(): void {
);
}
+export function systemUrl(
+ refreshMemory: boolean,
+ gpuMaxAgeMs?: number,
+ probeMedia = false,
+): string {
+ const params = new URLSearchParams();
+ if (refreshMemory) params.set("refresh_memory", "true");
+ if (probeMedia) params.set("probe_media", "true");
+ if (gpuMaxAgeMs !== undefined && Number.isFinite(gpuMaxAgeMs) && gpuMaxAgeMs > 0) {
+ params.set("gpu_max_age", String(gpuMaxAgeMs / 1000));
+ }
+ const query = params.toString();
+ return query ? `/api/system?${query}` : "/api/system";
+}
+
export async function fetchSystemInfo({
force = false,
refreshMemory = false,
+ gpuMaxAgeMs,
probeMedia = false,
-}: { force?: boolean; refreshMemory?: boolean; probeMedia?: boolean } = {}): Promise<SystemInfoResponse | null> {
+}: {
+ force?: boolean;
+ refreshMemory?: boolean;
+ /** The backend clamps to 1-10 s. */
+ gpuMaxAgeMs?: number;
+ probeMedia?: boolean;
+} = {}): Promise<SystemInfoResponse | null> {
if (systemFetchPromise) {
- if (!refreshMemory && (!probeMedia || systemFetchProbesMedia)) return systemFetchPromise;
- // A resident-memory refresh or media probe needs more than an ordinary snapshot.
+ // A pending fetch with a looser GPU bound would hand a fast poll the 10 s cache.
+ const looser =
+ gpuMaxAgeMs !== undefined &&
+ (systemFetchGpuMaxAgeMs === undefined || systemFetchGpuMaxAgeMs > gpuMaxAgeMs);
+ if (!refreshMemory && !looser && (!probeMedia || systemFetchProbesMedia)) {
+ return systemFetchPromise;
+ }
+ // A resident-memory refresh, fresher GPU read or media probe needs more than an ordinary snapshot.
await systemFetchPromise;
- return fetchSystemInfo({ force, refreshMemory, probeMedia });
+ return fetchSystemInfo({ force, refreshMemory, gpuMaxAgeMs, probeMedia });
}
if (!force && !refreshMemory && !probeMedia && cachedSystem) {
refreshDeviceTypeAfterSystemInfo({ detectHardware: true });
return cachedSystem;
}
+ systemFetchGpuMaxAgeMs = gpuMaxAgeMs;
systemFetchProbesMedia = probeMedia;
systemFetchPromise = (async () => {
const timeout = disposableTimeoutSignal(SYSTEM_FETCH_TIMEOUT_MS);
try {
- const query = new URLSearchParams();
- if (refreshMemory) query.set("refresh_memory", "true");
- if (probeMedia) query.set("probe_media", "true");
- const res = await authFetch(
- query.size ? "/api/system?" + query.toString() : "/api/system",
- { signal: timeout.signal },
- );
+ const res = await authFetch(systemUrl(refreshMemory, gpuMaxAgeMs, probeMedia), {
+ signal: timeout.signal,
+ });
if (!res.ok) throw new Error(`HTTP ${res.status}`);
const data = await res.json();
@@ -258,11 +285,13 @@ export async function fetchSystemInfo({
interface UseSystemInfoOptions {
pollMs?: number;
enabled?: boolean;
+ gpuFollowsPoll?: boolean;
}
export function useSystemInfo({
pollMs,
enabled = true,
+ gpuFollowsPoll = false,
}: UseSystemInfoOptions = {}): SystemInfoResponse {
const [systemInfo, setSystemInfo] = useState<SystemInfoResponse>(cachedSystem ?? DEFAULT_SYSTEM);
const [failedPolls, setFailedPolls] = useState(0);
@@ -282,7 +311,7 @@ export function useSystemInfo({
const update = (force: boolean) => {
inFlight = true;
- void fetchSystemInfo({ force })
+ void fetchSystemInfo({ force, gpuMaxAgeMs: gpuFollowsPoll ? pollMs : undefined })
.then((info) => {
if (cancelled) return;
setFailedPolls((previous) => nextFailedPolls(previous, info !== null));
@@ -322,7 +351,7 @@ export function useSystemInfo({
if (timeoutId !== null) window.clearTimeout(timeoutId);
document.removeEventListener("visibilitychange", onVisibilityChange);
};
- }, [enabled, pollMs]);
+ }, [enabled, pollMs, gpuFollowsPoll]);
const stale = enabled && isReadingStale(systemInfo.status, failedPolls, Boolean(pollMs));
return useMemo(
diff --git a/studio/frontend/src/i18n/locales/ar.ts b/studio/frontend/src/i18n/locales/ar.ts
index 60ed5f53225..b57c2b388a4 100644
--- a/studio/frontend/src/i18n/locales/ar.ts
+++ b/studio/frontend/src/i18n/locales/ar.ts
@@ -2579,11 +2579,25 @@ export const ar = {
gpuUnusableDetail: "تم اكتشافه، لكن PyTorch لا يستطيع استخدامه",
detailedView: "عرض مفصل",
detailedViewDescription:
- "اعرض حمل المعالج وحمل كل وحدة GPU وحرارتها واستهلاكها للطاقة في النافذة العائمة.",
- cpuLoad: "حمل المعالج",
+ "اعرض حمل كل وحدة GPU وحرارتها واستهلاكها للطاقة في النافذة العائمة.",
gpuLoad: "حمل GPU",
temperature: "الحرارة",
power: "الطاقة",
+ memory: "الذاكرة",
+ gpuInUse: "مستخدمة بواسطة GPU",
+ availableForModels: "متاحة للنماذج",
+ refreshRate: "معدل التحديث",
+ refreshRateDescription: "عدد مرات قراءة الشاشة العائمة لاستخدام الذاكرة وGPU أثناء فتحها.",
+ refreshEvery: "كل {seconds} ث",
+ unsloth: "Unsloth",
+ otherApps: "تطبيقات أخرى",
+ otherInUse: "استخدام آخر",
+ freeLabel: "متاح",
+ unslothApp: "تطبيق Unsloth",
+ unslothShare: "إظهار حصة Unsloth",
+ unslothShareDescription: "تقسيم الذاكرة بين ما يستخدمه Unsloth وما تستخدمه التطبيقات الأخرى والمتاح.",
+ modelBreakdown: "التفصيل حسب النموذج",
+ modelBreakdownDescription: "تقسيم حصة Unsloth في شريط الذاكرة إلى كل نموذج محمّل وبقية التطبيق.",
},
gpu: {
title: "أجهزة GPU",
@@ -5200,6 +5214,7 @@ export const ar = {
monitor: {
dragHandleLabel: "انقل شاشة المراقبة المباشرة. مفاتيح الأسهم تحركها قليلًا، والنقر المزدوج يعيدها إلى مكانها.",
reconnecting: "جارٍ إعادة الاتصال...",
+ resizeHint: "اسحب جانبًا أو زاوية لتغيير العرض. انقر نقرًا مزدوجًا لإعادته.",
},
},
projectsPage: {
diff --git a/studio/frontend/src/i18n/locales/cs.ts b/studio/frontend/src/i18n/locales/cs.ts
index 950b21aaf65..420b0ac6b3b 100644
--- a/studio/frontend/src/i18n/locales/cs.ts
+++ b/studio/frontend/src/i18n/locales/cs.ts
@@ -2780,7 +2780,22 @@ export const cs = {
"Sledujte, co ostatní aplikace posílají do API tohoto serveru, hned jak to dorazí.",
summary: "Živé požadavky, chyby a využití tokenů",
status: "Aktivní: {active} · nedávné: {recent} · {model}",
- noModelLoaded: "žádný model není načten",
+ noModelLoaded: "Žádný model není načten",
+ memory: "Paměť",
+ gpuInUse: "Využití GPU",
+ availableForModels: "K dispozici pro modely",
+ refreshRate: "Obnovovací frekvence",
+ refreshRateDescription: "Jak často plovoucí monitor čte využití paměti a GPU, když je otevřený.",
+ refreshEvery: "Každých {seconds} s",
+ unsloth: "Unsloth",
+ otherApps: "Ostatní aplikace",
+ otherInUse: "Ostatní využití",
+ freeLabel: "Volné",
+ unslothApp: "Aplikace Unsloth",
+ unslothShare: "Zobrazit podíl Unsloth",
+ unslothShareDescription: "Rozdělí paměť na to, co používá Unsloth, co používají ostatní aplikace a co je volné.",
+ modelBreakdown: "Rozpis podle modelu",
+ modelBreakdownDescription: "Rozdělí část paměťového pruhu patřící Unsloth na jednotlivé načtené modely a zbytek aplikace.",
autoOpen: "Automaticky otevírat plovoucí sledování",
autoOpenDescription: "Když dorazí provoz API, otevře malý panel.",
cpu: "CPU",
@@ -2796,8 +2811,7 @@ export const cs = {
gpuUnusableDetail: "Rozpoznáno, ale PyTorch ho nemůže použít",
detailedView: "Podrobné zobrazení",
detailedViewDescription:
- "Zobrazovat v plovoucím okně zatížení CPU a zatížení, teplotu a příkon každého GPU.",
- cpuLoad: "Zatížení CPU",
+ "Zobrazovat v plovoucím okně zatížení, teplotu a příkon každého GPU.",
gpuLoad: "Zatížení GPU",
temperature: "Teplota",
power: "Příkon",
@@ -5614,6 +5628,7 @@ export const cs = {
monitor: {
dragHandleLabel:
"Přesunout živý monitor. Šipky ho posunou, dvojklik ho vrátí na výchozí místo.",
+ resizeHint: "Přetažením okraje nebo rohu změníte šířku. Dvojklik ji obnoví.",
reconnecting: "Opětovné připojování...",
},
},
diff --git a/studio/frontend/src/i18n/locales/de.ts b/studio/frontend/src/i18n/locales/de.ts
index adc4eb322e2..d6e66f5841a 100644
--- a/studio/frontend/src/i18n/locales/de.ts
+++ b/studio/frontend/src/i18n/locales/de.ts
@@ -2593,7 +2593,7 @@ export const de = {
apiDescription: "Sieh, was andere Apps an die API dieses Servers senden, sobald es ankommt.",
summary: "Aktive Anfragen, Fehler und Token-Nutzung",
status: "Aktiv: {active} · kürzlich: {recent} · {model}",
- noModelLoaded: "kein Modell geladen",
+ noModelLoaded: "Kein Modell geladen",
autoOpen: "Schwebenden Monitor automatisch anzeigen",
autoOpenDescription:
"Öffnet ein kleines Fenster, wenn API-Aktivität eingeht.",
@@ -2610,11 +2610,25 @@ export const de = {
gpuUnusableDetail: "Erkannt, aber PyTorch kann sie nicht nutzen",
detailedView: "Detailansicht",
detailedViewDescription:
- "Zeigt CPU-Last sowie Last, Temperatur und Leistungsaufnahme jeder GPU im schwebenden Fenster.",
- cpuLoad: "CPU-Last",
+ "Zeigt Last, Temperatur und Leistungsaufnahme jeder GPU im schwebenden Fenster.",
gpuLoad: "GPU-Last",
temperature: "Temperatur",
power: "Leistung",
+ memory: "Arbeitsspeicher",
+ gpuInUse: "Von der GPU belegt",
+ availableForModels: "Für Modelle verfügbar",
+ refreshRate: "Aktualisierungsrate",
+ refreshRateDescription: "Wie oft der schwebende Monitor Speicher- und GPU-Auslastung liest, solange er geöffnet ist.",
+ refreshEvery: "Alle {seconds} s",
+ unsloth: "Unsloth",
+ otherApps: "Andere Apps",
+ otherInUse: "Sonstige Nutzung",
+ freeLabel: "Frei",
+ unslothApp: "Unsloth-App",
+ unslothShare: "Anteil von Unsloth anzeigen",
+ unslothShareDescription: "Teilt den Speicher in Unsloth, andere Apps und freien Speicher auf.",
+ modelBreakdown: "Nach Modell aufschlüsseln",
+ modelBreakdownDescription: "Teilt den Anteil von Unsloth im Speicherbalken in jedes geladene Modell und den Rest der App auf.",
},
gpu: {
title: "GPU-Geräte",
@@ -5274,6 +5288,7 @@ export const de = {
monitor: {
dragHandleLabel: "Live-Monitor verschieben. Mit den Pfeiltasten feinjustieren, per Doppelklick zurücksetzen.",
reconnecting: "Verbindung wird wiederhergestellt...",
+ resizeHint: "Zum Ändern der Breite an einer Seite oder Ecke ziehen. Doppelklick setzt sie zurück.",
},
},
projectsPage: {
diff --git a/studio/frontend/src/i18n/locales/en.ts b/studio/frontend/src/i18n/locales/en.ts
index 68217d1355e..191802936f6 100644
--- a/studio/frontend/src/i18n/locales/en.ts
+++ b/studio/frontend/src/i18n/locales/en.ts
@@ -2580,7 +2580,7 @@ export const en = {
apiDescription: "See what other apps send to this server's API as it arrives.",
summary: "Live requests, errors, and token usage",
status: "{active} active · {recent} recent · {model}",
- noModelLoaded: "no model loaded",
+ noModelLoaded: "No model loaded",
autoOpen: "Floating monitor opens automatically",
autoOpenDescription: "Opens a small panel when API traffic arrives.",
cpu: "CPU",
@@ -2596,11 +2596,25 @@ export const en = {
gpuUnusableDetail: "Detected, but PyTorch cannot use it",
detailedView: "Detailed view",
detailedViewDescription:
- "Show CPU load and each GPU's load, temperature and power in the floating window.",
- cpuLoad: "CPU load",
+ "Show each GPU's load, temperature and power in the floating window.",
gpuLoad: "GPU load",
temperature: "Temperature",
power: "Power",
+ memory: "Memory",
+ gpuInUse: "GPU in use",
+ availableForModels: "Available for models",
+ refreshRate: "Refresh rate",
+ refreshRateDescription: "How often the floating monitor reads memory and GPU usage while it is open.",
+ refreshEvery: "Every {seconds} s",
+ unsloth: "Unsloth",
+ otherApps: "Other apps",
+ otherInUse: "Other in use",
+ freeLabel: "Free",
+ unslothApp: "Unsloth app",
+ unslothShare: "Show Unsloth's share",
+ unslothShareDescription: "Split memory into what Unsloth uses, what other apps use, and what is free.",
+ modelBreakdown: "Break down by model",
+ modelBreakdownDescription: "Split Unsloth's part of the memory bar into each loaded model and the rest of the app.",
},
gpu: {
title: "GPU devices",
@@ -5239,6 +5253,7 @@ export const en = {
dragHandleLabel:
"Move the live monitor. Arrow keys nudge it, double-click resets it.",
reconnecting: "Reconnecting...",
+ resizeHint: "Drag a side or corner to change the width. Double-click resets it.",
},
},
projectsPage: {
diff --git a/studio/frontend/src/i18n/locales/es-419.ts b/studio/frontend/src/i18n/locales/es-419.ts
index c17630e806c..d6dbebd63d5 100644
--- a/studio/frontend/src/i18n/locales/es-419.ts
+++ b/studio/frontend/src/i18n/locales/es-419.ts
@@ -2805,7 +2805,22 @@ export const es419 = {
"Mira lo que otras apps envían a la API de este servidor en cuanto llega.",
summary: "Solicitudes en vivo, errores y uso de tokens",
status: "{active} activas · {recent} recientes · {model}",
- noModelLoaded: "ningún modelo cargado",
+ noModelLoaded: "Ningún modelo cargado",
+ memory: "Memoria",
+ gpuInUse: "GPU en uso",
+ availableForModels: "Disponible para modelos",
+ refreshRate: "Frecuencia de actualización",
+ refreshRateDescription: "Con qué frecuencia el monitor flotante lee el uso de memoria y GPU mientras está abierto.",
+ refreshEvery: "Cada {seconds} s",
+ unsloth: "Unsloth",
+ otherApps: "Otras apps",
+ otherInUse: "Otro uso",
+ freeLabel: "Libre",
+ unslothApp: "App de Unsloth",
+ unslothShare: "Mostrar la parte de Unsloth",
+ unslothShareDescription: "Divide la memoria en lo que usa Unsloth, lo que usan otras apps y lo que está libre.",
+ modelBreakdown: "Desglosar por modelo",
+ modelBreakdownDescription: "Divide la parte de Unsloth en la barra de memoria entre cada modelo cargado y el resto de la app.",
autoOpen: "El monitor flotante se abre automáticamente",
autoOpenDescription:
"Abre un panel pequeño cuando llega tráfico de la API.",
@@ -2822,8 +2837,7 @@ export const es419 = {
gpuUnusableDetail: "Detectada, pero PyTorch no puede usarla",
detailedView: "Vista detallada",
detailedViewDescription:
- "Muestra la carga de la CPU y la carga, temperatura y consumo de cada GPU en la ventana flotante.",
- cpuLoad: "Carga de CPU",
+ "Muestra la carga, temperatura y consumo de cada GPU en la ventana flotante.",
gpuLoad: "Carga de GPU",
temperature: "Temperatura",
power: "Consumo",
@@ -5681,6 +5695,7 @@ export const es419 = {
monitor: {
dragHandleLabel:
"Mover el monitor en vivo. Las teclas de flecha lo desplazan un poco; con doble clic se restablece.",
+ resizeHint: "Arrastra un borde o una esquina para cambiar el ancho. Doble clic lo restablece.",
reconnecting: "Reconectando...",
},
},
diff --git a/studio/frontend/src/i18n/locales/es.ts b/studio/frontend/src/i18n/locales/es.ts
index 8bb4280c966..d12977dd94b 100644
--- a/studio/frontend/src/i18n/locales/es.ts
+++ b/studio/frontend/src/i18n/locales/es.ts
@@ -2588,7 +2588,7 @@ export const es = {
apiDescription: "Mira lo que otras apps envían a la API de este servidor en cuanto llega.",
summary: "Solicitudes en curso, errores y uso de tokens",
status: "{active} activas · {recent} recientes · {model}",
- noModelLoaded: "ningún modelo cargado",
+ noModelLoaded: "Ningún modelo cargado",
autoOpen: "Mostrar automáticamente el monitor flotante",
autoOpenDescription:
"Abre un panel pequeño cuando llega tráfico de la API.",
@@ -2605,11 +2605,25 @@ export const es = {
gpuUnusableDetail: "Detectada, pero PyTorch no puede usarla",
detailedView: "Vista detallada",
detailedViewDescription:
- "Muestra la carga de la CPU y la carga, temperatura y consumo de cada GPU en la ventana flotante.",
- cpuLoad: "Carga de CPU",
+ "Muestra la carga, temperatura y consumo de cada GPU en la ventana flotante.",
gpuLoad: "Carga de GPU",
temperature: "Temperatura",
power: "Consumo",
+ memory: "Memoria",
+ gpuInUse: "En uso por la GPU",
+ availableForModels: "Disponible para modelos",
+ refreshRate: "Frecuencia de actualización",
+ refreshRateDescription: "Con qué frecuencia el monitor flotante lee el uso de memoria y GPU mientras está abierto.",
+ refreshEvery: "Cada {seconds} s",
+ unsloth: "Unsloth",
+ otherApps: "Otras apps",
+ otherInUse: "Otro uso",
+ freeLabel: "Libre",
+ unslothApp: "App de Unsloth",
+ unslothShare: "Mostrar la parte de Unsloth",
+ unslothShareDescription: "Divide la memoria entre lo que usa Unsloth, lo que usan otras apps y lo libre.",
+ modelBreakdown: "Desglosar por modelo",
+ modelBreakdownDescription: "Divide la parte de Unsloth en la barra de memoria entre cada modelo cargado y el resto de la app.",
},
gpu: {
title: "Dispositivos GPU",
@@ -5273,6 +5287,7 @@ export const es = {
monitor: {
dragHandleLabel: "Mover el monitor en vivo. Las teclas de flecha lo desplazan un poco; con doble clic se restablece.",
reconnecting: "Reconectando...",
+ resizeHint: "Arrastra un lado o una esquina para cambiar el ancho. Doble clic lo restablece.",
},
},
projectsPage: {
diff --git a/studio/frontend/src/i18n/locales/fa.ts b/studio/frontend/src/i18n/locales/fa.ts
index efe414fe70e..03f4bdd02b9 100644
--- a/studio/frontend/src/i18n/locales/fa.ts
+++ b/studio/frontend/src/i18n/locales/fa.ts
@@ -2753,6 +2753,21 @@ export const fa = {
summary: "درخواست‌ها، خطاها و مصرف توکن به‌صورت زنده",
status: "{active} فعال · {recent} اخیر · {model}",
noModelLoaded: "هیچ مدلی بارگذاری نشده",
+ memory: "حافظه",
+ gpuInUse: "GPU در حال استفاده",
+ availableForModels: "در دسترس برای مدل‌ها",
+ refreshRate: "نرخ تازه‌سازی",
+ refreshRateDescription: "هر چند وقت یک بار مانیتور شناور، مصرف حافظه و GPU را هنگام باز بودن می‌خواند.",
+ refreshEvery: "هر {seconds} ثانیه",
+ unsloth: "Unsloth",
+ otherApps: "برنامه‌های دیگر",
+ otherInUse: "مصرف دیگر",
+ freeLabel: "آزاد",
+ unslothApp: "برنامهٔ Unsloth",
+ unslothShare: "نمایش سهم Unsloth",
+ unslothShareDescription: "حافظه را به سهم Unsloth، سهم برنامه‌های دیگر و بخش آزاد تقسیم می‌کند.",
+ modelBreakdown: "تفکیک بر اساس مدل",
+ modelBreakdownDescription: "سهم Unsloth در نوار حافظه را به هر مدل بارگذاری‌شده و بقیهٔ برنامه تقسیم می‌کند.",
autoOpen: "پایشگر شناور خودکار باز شود",
autoOpenDescription: "وقتی ترافیک API می‌رسد، یک پنل کوچک باز می‌شود.",
cpu: "CPU",
@@ -2768,8 +2783,7 @@ export const fa = {
gpuUnusableDetail: "شناسایی شد، اما PyTorch نمی‌تواند از آن استفاده کند",
detailedView: "نمای جزئی",
detailedViewDescription:
- "بار CPU و بار، دما و توان هر GPU در پنجرهٔ شناور نمایش داده شود.",
- cpuLoad: "بار CPU",
+ "بار، دما و توان هر GPU در پنجرهٔ شناور نمایش داده شود.",
gpuLoad: "بار GPU",
temperature: "دما",
power: "توان",
@@ -5565,6 +5579,7 @@ export const fa = {
monitor: {
dragHandleLabel:
"جابه‌جایی پایشگر زنده. کلیدهای جهت‌نما آن را کمی جابه‌جا می‌کنند و دوبار کلیک آن را بازنشانی می‌کند.",
+ resizeHint: "برای تغییر عرض، یک لبه یا گوشه را بکشید. دوبار کلیک آن را بازنشانی می‌کند.",
reconnecting: "در حال اتصال دوباره...",
},
},
diff --git a/studio/frontend/src/i18n/locales/fr.ts b/studio/frontend/src/i18n/locales/fr.ts
index 082c6db5cf5..5bb32b5b7d0 100644
--- a/studio/frontend/src/i18n/locales/fr.ts
+++ b/studio/frontend/src/i18n/locales/fr.ts
@@ -2591,7 +2591,7 @@ export const fr = {
apiDescription: "Voyez ce que les autres applications envoient à l'API de ce serveur dès son arrivée.",
summary: "Requêtes en cours, erreurs et utilisation des jetons",
status: "{active} actives · {recent} récentes · {model}",
- noModelLoaded: "aucun modèle chargé",
+ noModelLoaded: "Aucun modèle chargé",
autoOpen: "Afficher automatiquement le moniteur flottant",
autoOpenDescription:
"Ouvre un petit panneau lorsque l’API reçoit du trafic.",
@@ -2608,11 +2608,25 @@ export const fr = {
gpuUnusableDetail: "Détecté, mais PyTorch ne peut pas l'utiliser",
detailedView: "Vue détaillée",
detailedViewDescription:
- "Affiche la charge du CPU ainsi que la charge, la température et la consommation de chaque GPU dans la fenêtre flottante.",
- cpuLoad: "Charge CPU",
+ "Affiche la charge, la température et la consommation de chaque GPU dans la fenêtre flottante.",
gpuLoad: "Charge GPU",
temperature: "Température",
power: "Puissance",
+ memory: "Mémoire",
+ gpuInUse: "Utilisée par le GPU",
+ availableForModels: "Disponible pour les modèles",
+ refreshRate: "Fréquence d'actualisation",
+ refreshRateDescription: "Fréquence à laquelle le moniteur flottant lit l'utilisation de la mémoire et du GPU lorsqu'il est ouvert.",
+ refreshEvery: "Toutes les {seconds} s",
+ unsloth: "Unsloth",
+ otherApps: "Autres apps",
+ otherInUse: "Autre usage",
+ freeLabel: "Libre",
+ unslothApp: "App Unsloth",
+ unslothShare: "Afficher la part d'Unsloth",
+ unslothShareDescription: "Répartit la mémoire entre Unsloth, les autres apps et la mémoire libre.",
+ modelBreakdown: "Détail par modèle",
+ modelBreakdownDescription: "Répartit la part d'Unsloth dans la barre de mémoire entre chaque modèle chargé et le reste de l'app.",
},
gpu: {
title: "Périphériques GPU",
@@ -5284,6 +5298,7 @@ export const fr = {
monitor: {
dragHandleLabel: "Déplacer le moniteur en direct. Les touches fléchées le déplacent légèrement, un double-clic le réinitialise.",
reconnecting: "Reconnexion...",
+ resizeHint: "Faites glisser un côté ou un coin pour changer la largeur. Double-cliquez pour la rétablir.",
},
},
projectsPage: {
diff --git a/studio/frontend/src/i18n/locales/he.ts b/studio/frontend/src/i18n/locales/he.ts
index 30cc0de88b6..1ba86070b3f 100644
--- a/studio/frontend/src/i18n/locales/he.ts
+++ b/studio/frontend/src/i18n/locales/he.ts
@@ -2633,11 +2633,25 @@ export const he = {
gpuUnusableDetail: "זוהה, אך PyTorch אינו יכול להשתמש בו",
detailedView: "תצוגה מפורטת",
detailedViewDescription:
- "הצגת עומס המעבד ועומס, טמפרטורה וצריכת חשמל של כל GPU בחלון הצף.",
- cpuLoad: "עומס מעבד",
+ "הצגת עומס, טמפרטורה וצריכת חשמל של כל GPU בחלון הצף.",
gpuLoad: "עומס GPU",
temperature: "טמפרטורה",
power: "הספק",
+ memory: "זיכרון",
+ gpuInUse: "בשימוש ה-GPU",
+ availableForModels: "זמין למודלים",
+ refreshRate: "קצב רענון",
+ refreshRateDescription: "באיזו תדירות המוניטור הצף קורא את השימוש בזיכרון וב-GPU כשהוא פתוח.",
+ refreshEvery: "כל {seconds} שנ׳",
+ unsloth: "Unsloth",
+ otherApps: "אפליקציות אחרות",
+ otherInUse: "שימוש אחר",
+ freeLabel: "פנוי",
+ unslothApp: "אפליקציית Unsloth",
+ unslothShare: "הצגת החלק של Unsloth",
+ unslothShareDescription: "חלוקת הזיכרון בין Unsloth, אפליקציות אחרות וזיכרון פנוי.",
+ modelBreakdown: "פירוט לפי מודל",
+ modelBreakdownDescription: "חלוקת החלק של Unsloth בסרגל הזיכרון לכל מודל טעון ולשאר האפליקציה.",
},
gpu: {
title: "התקני GPU",
@@ -5299,6 +5313,7 @@ export const he = {
monitor: {
dragHandleLabel: "הזז את מסך הניטור החי. מקשי החיצים מזיזים אותו מעט, ולחיצה כפולה מאפסת אותו.",
reconnecting: "מתחבר מחדש...",
+ resizeHint: "גררו צד או פינה כדי לשנות את הרוחב. לחיצה כפולה מאפסת אותו.",
},
},
projectsPage: {
diff --git a/studio/frontend/src/i18n/locales/hi.ts b/studio/frontend/src/i18n/locales/hi.ts
index d63dcfc968b..52c6a2d8bc7 100644
--- a/studio/frontend/src/i18n/locales/hi.ts
+++ b/studio/frontend/src/i18n/locales/hi.ts
@@ -2585,11 +2585,25 @@ export const hi = {
gpuUnusableDetail: "पहचाना गया, लेकिन PyTorch इसका उपयोग नहीं कर सकता",
detailedView: "विस्तृत दृश्य",
detailedViewDescription:
- "फ़्लोटिंग विंडो में CPU लोड तथा हर GPU का लोड, तापमान और पावर दिखाएँ।",
- cpuLoad: "CPU लोड",
+ "फ़्लोटिंग विंडो में हर GPU का लोड, तापमान और पावर दिखाएँ।",
gpuLoad: "GPU लोड",
temperature: "तापमान",
power: "पावर",
+ memory: "मेमोरी",
+ gpuInUse: "GPU द्वारा उपयोग में",
+ availableForModels: "मॉडल के लिए उपलब्ध",
+ refreshRate: "रीफ़्रेश दर",
+ refreshRateDescription: "खुला रहने पर फ़्लोटिंग मॉनिटर कितनी बार मेमोरी और GPU उपयोग पढ़ता है।",
+ refreshEvery: "हर {seconds} से.",
+ unsloth: "Unsloth",
+ otherApps: "अन्य ऐप्स",
+ otherInUse: "अन्य उपयोग",
+ freeLabel: "खाली",
+ unslothApp: "Unsloth ऐप",
+ unslothShare: "Unsloth का हिस्सा दिखाएं",
+ unslothShareDescription: "मेमोरी को Unsloth, अन्य ऐप्स और खाली हिस्से में बांटें।",
+ modelBreakdown: "मॉडल के अनुसार विवरण",
+ modelBreakdownDescription: "मेमोरी बार में Unsloth के हिस्से को हर लोड किए गए मॉडल और बाकी ऐप में बांटें।",
},
gpu: {
title: "GPU डिवाइस",
@@ -5211,6 +5225,7 @@ export const hi = {
monitor: {
dragHandleLabel: "लाइव मॉनिटर हिलाएँ। एरो कुंजियाँ इसे थोड़ा खिसकाती हैं, डबल-क्लिक करने पर यह रीसेट हो जाता है।",
reconnecting: "फिर से कनेक्ट हो रहा है...",
+ resizeHint: "चौड़ाई बदलने के लिए कोई किनारा या कोना खींचें। डबल-क्लिक से रीसेट होता है।",
},
},
projectsPage: {
diff --git a/studio/frontend/src/i18n/locales/id.ts b/studio/frontend/src/i18n/locales/id.ts
index db364dd1725..556c59dc2e1 100644
--- a/studio/frontend/src/i18n/locales/id.ts
+++ b/studio/frontend/src/i18n/locales/id.ts
@@ -2765,7 +2765,22 @@ export const id = {
"Lihat apa yang dikirim aplikasi lain ke API server ini saat tiba.",
summary: "Permintaan, kesalahan, dan penggunaan token secara langsung",
status: "{active} aktif · {recent} terbaru · {model}",
- noModelLoaded: "tidak ada model yang dimuat",
+ noModelLoaded: "Tidak ada model yang dimuat",
+ memory: "Memori",
+ gpuInUse: "GPU terpakai",
+ availableForModels: "Tersedia untuk model",
+ refreshRate: "Laju penyegaran",
+ refreshRateDescription: "Seberapa sering monitor mengambang membaca penggunaan memori dan GPU saat terbuka.",
+ refreshEvery: "Setiap {seconds} dtk",
+ unsloth: "Unsloth",
+ otherApps: "Aplikasi lain",
+ otherInUse: "Penggunaan lain",
+ freeLabel: "Kosong",
+ unslothApp: "Aplikasi Unsloth",
+ unslothShare: "Tampilkan bagian Unsloth",
+ unslothShareDescription: "Bagi memori menjadi yang dipakai Unsloth, yang dipakai aplikasi lain, dan yang kosong.",
+ modelBreakdown: "Rinci per model",
+ modelBreakdownDescription: "Bagi bagian Unsloth di bilah memori menjadi tiap model yang dimuat dan sisa aplikasi.",
autoOpen: "Pemantau mengambang terbuka otomatis",
autoOpenDescription: "Membuka panel kecil saat ada lalu lintas API.",
cpu: "CPU",
@@ -2782,8 +2797,7 @@ export const id = {
"Terdeteksi, tetapi PyTorch tidak dapat menggunakannya",
detailedView: "Tampilan terperinci",
detailedViewDescription:
- "Tampilkan beban CPU serta beban, suhu, dan daya setiap GPU di jendela mengambang.",
- cpuLoad: "Beban CPU",
+ "Tampilkan beban, suhu, dan daya setiap GPU di jendela mengambang.",
gpuLoad: "Beban GPU",
temperature: "Suhu",
power: "Daya",
@@ -5599,6 +5613,7 @@ export const id = {
monitor: {
dragHandleLabel:
"Pindahkan pemantau langsung. Tombol panah menggesernya sedikit, klik dua kali untuk mengatur ulang.",
+ resizeHint: "Seret sisi atau sudut untuk mengubah lebar. Klik dua kali untuk mengatur ulang.",
reconnecting: "Menyambungkan kembali...",
},
},
diff --git a/studio/frontend/src/i18n/locales/it.ts b/studio/frontend/src/i18n/locales/it.ts
index 24f4fcc08ed..ab77683c7fd 100644
--- a/studio/frontend/src/i18n/locales/it.ts
+++ b/studio/frontend/src/i18n/locales/it.ts
@@ -2493,7 +2493,7 @@ export const it = {
apiDescription: "Guarda cosa inviano le altre app all'API di questo server non appena arriva.",
summary: "Richieste attive, errori e utilizzo dei token",
status: "{active} attive · {recent} recenti · {model}",
- noModelLoaded: "nessun modello caricato",
+ noModelLoaded: "Nessun modello caricato",
autoOpen: "Mostra automaticamente il monitor fluttuante",
autoOpenDescription:
"Apre un piccolo pannello quando arriva traffico API.",
@@ -2510,11 +2510,25 @@ export const it = {
gpuUnusableDetail: "Rilevata, ma PyTorch non può usarla",
detailedView: "Vista dettagliata",
detailedViewDescription:
- "Mostra il carico della CPU e carico, temperatura e consumo di ogni GPU nella finestra mobile.",
- cpuLoad: "Carico CPU",
+ "Mostra carico, temperatura e consumo di ogni GPU nella finestra mobile.",
gpuLoad: "Carico GPU",
temperature: "Temperatura",
power: "Consumo",
+ memory: "Memoria",
+ gpuInUse: "In uso dalla GPU",
+ availableForModels: "Disponibile per i modelli",
+ refreshRate: "Frequenza di aggiornamento",
+ refreshRateDescription: "Ogni quanto il monitor fluttuante legge l'uso di memoria e GPU mentre è aperto.",
+ refreshEvery: "Ogni {seconds} s",
+ unsloth: "Unsloth",
+ otherApps: "Altre app",
+ otherInUse: "Altro uso",
+ freeLabel: "Libera",
+ unslothApp: "App Unsloth",
+ unslothShare: "Mostra la quota di Unsloth",
+ unslothShareDescription: "Divide la memoria tra Unsloth, le altre app e quella libera.",
+ modelBreakdown: "Dettaglio per modello",
+ modelBreakdownDescription: "Divide la quota di Unsloth nella barra della memoria tra ogni modello caricato e il resto dell'app.",
},
gpu: {
title: "Dispositivi GPU",
@@ -5269,6 +5283,7 @@ export const it = {
monitor: {
dragHandleLabel: "Sposta il monitor in tempo reale. I tasti freccia lo spostano leggermente, il doppio clic lo reimposta.",
reconnecting: "Riconnessione...",
+ resizeHint: "Trascina un lato o un angolo per cambiare la larghezza. Doppio clic la ripristina.",
},
},
projectsPage: {
diff --git a/studio/frontend/src/i18n/locales/ja.ts b/studio/frontend/src/i18n/locales/ja.ts
index 521040c4f14..b62592e45dd 100644
--- a/studio/frontend/src/i18n/locales/ja.ts
+++ b/studio/frontend/src/i18n/locales/ja.ts
@@ -2560,11 +2560,25 @@ export const ja = {
gpuUnusableDetail: "検出されましたが、PyTorch から利用できません",
detailedView: "詳細表示",
detailedViewDescription:
- "フローティングウィンドウに、CPU 負荷と各 GPU の負荷、温度、消費電力を表示します。",
- cpuLoad: "CPU 負荷",
+ "フローティングウィンドウに、各 GPU の負荷、温度、消費電力を表示します。",
gpuLoad: "GPU 負荷",
temperature: "温度",
power: "消費電力",
+ memory: "メモリ",
+ gpuInUse: "GPU 使用中",
+ availableForModels: "モデルに使用可能",
+ refreshRate: "更新間隔",
+ refreshRateDescription: "フローティングモニターを開いている間、メモリと GPU の使用量を読み取る頻度です。",
+ refreshEvery: "{seconds} 秒ごと",
+ unsloth: "Unsloth",
+ otherApps: "他のアプリ",
+ otherInUse: "その他の使用",
+ freeLabel: "空き",
+ unslothApp: "Unsloth アプリ",
+ unslothShare: "Unsloth の使用分を表示",
+ unslothShareDescription: "メモリを Unsloth、他のアプリ、空きに分けて表示します。",
+ modelBreakdown: "モデル別に表示",
+ modelBreakdownDescription: "メモリバーの Unsloth 分を、読み込んだ各モデルとアプリのその他の分に分けて表示します。",
},
gpu: {
title: "GPU デバイス",
@@ -5151,6 +5165,7 @@ export const ja = {
monitor: {
dragHandleLabel: "ライブモニターを移動します。矢印キーで少しずつ動かせ、ダブルクリックで位置をリセットします。",
reconnecting: "再接続中...",
+ resizeHint: "辺または角をドラッグして幅を変更します。ダブルクリックでリセットします。",
},
},
projectsPage: {
diff --git a/studio/frontend/src/i18n/locales/ko.ts b/studio/frontend/src/i18n/locales/ko.ts
index 028a0417072..d75f23b6a0a 100644
--- a/studio/frontend/src/i18n/locales/ko.ts
+++ b/studio/frontend/src/i18n/locales/ko.ts
@@ -2573,11 +2573,25 @@ export const ko = {
gpuUnusableDetail: "감지되었지만 PyTorch에서 사용할 수 없습니다",
detailedView: "자세히 보기",
detailedViewDescription:
- "플로팅 창에 CPU 부하와 각 GPU의 부하, 온도, 전력을 표시합니다.",
- cpuLoad: "CPU 부하",
+ "플로팅 창에 각 GPU의 부하, 온도, 전력을 표시합니다.",
gpuLoad: "GPU 부하",
temperature: "온도",
power: "전력",
+ memory: "메모리",
+ gpuInUse: "GPU 사용 중",
+ availableForModels: "모델에 사용 가능",
+ refreshRate: "새로 고침 빈도",
+ refreshRateDescription: "플로팅 모니터가 열려 있는 동안 메모리와 GPU 사용량을 읽는 빈도입니다.",
+ refreshEvery: "{seconds}초마다",
+ unsloth: "Unsloth",
+ otherApps: "다른 앱",
+ otherInUse: "기타 사용",
+ freeLabel: "여유",
+ unslothApp: "Unsloth 앱",
+ unslothShare: "Unsloth 사용량 표시",
+ unslothShareDescription: "메모리를 Unsloth, 다른 앱, 여유 공간으로 나눠 보여줍니다.",
+ modelBreakdown: "모델별로 나누기",
+ modelBreakdownDescription: "메모리 막대의 Unsloth 부분을 로드된 각 모델과 나머지 앱으로 나눠 보여줍니다.",
},
gpu: {
title: "GPU 장치",
@@ -5191,6 +5205,7 @@ export const ko = {
monitor: {
dragHandleLabel: "실시간 모니터를 이동합니다. 방향키로 조금씩 움직이고, 더블클릭하면 위치가 초기화됩니다.",
reconnecting: "다시 연결하는 중...",
+ resizeHint: "옆면이나 모서리를 끌어 너비를 조절하세요. 두 번 클릭하면 초기화됩니다.",
},
},
projectsPage: {
diff --git a/studio/frontend/src/i18n/locales/nl.ts b/studio/frontend/src/i18n/locales/nl.ts
index 8b451bae38a..293ddb73667 100644
--- a/studio/frontend/src/i18n/locales/nl.ts
+++ b/studio/frontend/src/i18n/locales/nl.ts
@@ -2801,7 +2801,22 @@ export const nl = {
"Zie direct wat andere apps naar de API van deze server sturen.",
summary: "Live verzoeken, fouten en tokengebruik",
status: "{active} actief · {recent} recent · {model}",
- noModelLoaded: "geen model geladen",
+ noModelLoaded: "Geen model geladen",
+ memory: "Geheugen",
+ gpuInUse: "GPU in gebruik",
+ availableForModels: "Beschikbaar voor modellen",
+ refreshRate: "Verversingssnelheid",
+ refreshRateDescription: "Hoe vaak de zwevende monitor geheugen- en GPU-gebruik leest terwijl hij open is.",
+ refreshEvery: "Elke {seconds} s",
+ unsloth: "Unsloth",
+ otherApps: "Andere apps",
+ otherInUse: "Overig in gebruik",
+ freeLabel: "Vrij",
+ unslothApp: "Unsloth-app",
+ unslothShare: "Aandeel van Unsloth tonen",
+ unslothShareDescription: "Verdeel het geheugen in wat Unsloth gebruikt, wat andere apps gebruiken en wat vrij is.",
+ modelBreakdown: "Uitsplitsen per model",
+ modelBreakdownDescription: "Verdeel het deel van Unsloth in de geheugenbalk over elk geladen model en de rest van de app.",
autoOpen: "Zwevende monitor opent automatisch",
autoOpenDescription:
"Opent een klein paneel wanneer er API-verkeer binnenkomt.",
@@ -2818,8 +2833,7 @@ export const nl = {
gpuUnusableDetail: "Gedetecteerd, maar PyTorch kan hem niet gebruiken",
detailedView: "Gedetailleerde weergave",
detailedViewDescription:
- "CPU-belasting en per GPU de belasting, temperatuur en het vermogen tonen in het zwevende venster.",
- cpuLoad: "CPU-belasting",
+ "Per GPU de belasting, temperatuur en het vermogen tonen in het zwevende venster.",
gpuLoad: "GPU-belasting",
temperature: "Temperatuur",
power: "Vermogen",
@@ -5652,6 +5666,7 @@ export const nl = {
monitor: {
dragHandleLabel:
"De live monitor verplaatsen. Pijltoetsen verschuiven hem, dubbelklikken zet hem terug.",
+ resizeHint: "Sleep een zijkant of hoek om de breedte te wijzigen. Dubbelklik om te herstellen.",
reconnecting: "Opnieuw verbinden...",
},
},
diff --git a/studio/frontend/src/i18n/locales/pl.ts b/studio/frontend/src/i18n/locales/pl.ts
index 6ad9eeb2b64..95aa4397982 100644
--- a/studio/frontend/src/i18n/locales/pl.ts
+++ b/studio/frontend/src/i18n/locales/pl.ts
@@ -2797,7 +2797,22 @@ export const pl = {
"Zobacz na bieżąco, co inne aplikacje wysyłają do API tego serwera.",
summary: "Żądania na żywo, błędy i użycie tokenów",
status: "Aktywne: {active} · Ostatnie: {recent} · {model}",
- noModelLoaded: "nie wczytano modelu",
+ noModelLoaded: "Nie wczytano modelu",
+ memory: "Pamięć",
+ gpuInUse: "Użycie GPU",
+ availableForModels: "Dostępne dla modeli",
+ refreshRate: "Częstotliwość odświeżania",
+ refreshRateDescription: "Jak często pływający monitor odczytuje użycie pamięci i GPU, gdy jest otwarty.",
+ refreshEvery: "Co {seconds} s",
+ unsloth: "Unsloth",
+ otherApps: "Inne aplikacje",
+ otherInUse: "Inne użycie",
+ freeLabel: "Wolne",
+ unslothApp: "Aplikacja Unsloth",
+ unslothShare: "Pokaż udział Unsloth",
+ unslothShareDescription: "Podziel pamięć na to, czego używa Unsloth, czego używają inne aplikacje i co jest wolne.",
+ modelBreakdown: "Podział według modelu",
+ modelBreakdownDescription: "Podziel część paska pamięci należącą do Unsloth na każdy załadowany model i resztę aplikacji.",
autoOpen: "Monitor pływający otwiera się automatycznie",
autoOpenDescription: "Otwiera mały panel, gdy pojawia się ruch API.",
cpu: "CPU",
@@ -2813,8 +2828,7 @@ export const pl = {
gpuUnusableDetail: "Wykryty, ale PyTorch nie może go używać",
detailedView: "Widok szczegółowy",
detailedViewDescription:
- "Pokazuj w oknie pływającym obciążenie CPU oraz obciążenie, temperaturę i pobór mocy każdego GPU.",
- cpuLoad: "Obciążenie CPU",
+ "Pokazuj w oknie pływającym obciążenie, temperaturę i pobór mocy każdego GPU.",
gpuLoad: "Obciążenie GPU",
temperature: "Temperatura",
power: "Pobór mocy",
@@ -5648,6 +5662,7 @@ export const pl = {
monitor: {
dragHandleLabel:
"Przesuń monitor na żywo. Klawisze strzałek lekko go przesuwają, dwukrotne kliknięcie przywraca położenie.",
+ resizeHint: "Przeciągnij krawędź lub róg, aby zmienić szerokość. Dwuklik przywraca domyślną.",
reconnecting: "Ponowne łączenie...",
},
},
diff --git a/studio/frontend/src/i18n/locales/pt-br.ts b/studio/frontend/src/i18n/locales/pt-br.ts
index 969287c487a..d0ad302b72d 100644
--- a/studio/frontend/src/i18n/locales/pt-br.ts
+++ b/studio/frontend/src/i18n/locales/pt-br.ts
@@ -2576,7 +2576,7 @@ export const ptBR = {
apiDescription: "Veja o que outros apps enviam para a API deste servidor assim que chega.",
summary: "Solicitações ativas, erros e uso de tokens",
status: "{active} ativas · {recent} recentes · {model}",
- noModelLoaded: "nenhum modelo carregado",
+ noModelLoaded: "Nenhum modelo carregado",
autoOpen: "Mostrar o monitor flutuante automaticamente",
autoOpenDescription:
"Abre um pequeno painel quando chega tráfego da API.",
@@ -2593,11 +2593,25 @@ export const ptBR = {
gpuUnusableDetail: "Detectada, mas o PyTorch não consegue usá-la",
detailedView: "Visualização detalhada",
detailedViewDescription:
- "Mostra a carga da CPU e a carga, temperatura e consumo de cada GPU na janela flutuante.",
- cpuLoad: "Carga da CPU",
+ "Mostra a carga, temperatura e consumo de cada GPU na janela flutuante.",
gpuLoad: "Carga da GPU",
temperature: "Temperatura",
power: "Consumo",
+ memory: "Memória",
+ gpuInUse: "Em uso pela GPU",
+ availableForModels: "Disponível para modelos",
+ refreshRate: "Taxa de atualização",
+ refreshRateDescription: "Com que frequência o monitor flutuante lê o uso de memória e GPU enquanto está aberto.",
+ refreshEvery: "A cada {seconds} s",
+ unsloth: "Unsloth",
+ otherApps: "Outros apps",
+ otherInUse: "Outro uso",
+ freeLabel: "Livre",
+ unslothApp: "App do Unsloth",
+ unslothShare: "Mostrar a parte do Unsloth",
+ unslothShareDescription: "Divide a memória entre o que o Unsloth usa, o que outros apps usam e o que está livre.",
+ modelBreakdown: "Detalhar por modelo",
+ modelBreakdownDescription: "Divide a parte do Unsloth na barra de memória entre cada modelo carregado e o restante do app.",
},
gpu: {
title: "Dispositivos de GPU",
@@ -5229,6 +5243,7 @@ export const ptBR = {
monitor: {
dragHandleLabel: "Mover o monitor ao vivo. As setas do teclado o deslocam um pouco; clique duplo o redefine.",
reconnecting: "Reconectando...",
+ resizeHint: "Arraste uma lateral ou um canto para mudar a largura. Clique duas vezes para redefinir.",
},
},
projectsPage: {
diff --git a/studio/frontend/src/i18n/locales/ru.ts b/studio/frontend/src/i18n/locales/ru.ts
index c4494e8725d..c354601d73a 100644
--- a/studio/frontend/src/i18n/locales/ru.ts
+++ b/studio/frontend/src/i18n/locales/ru.ts
@@ -2573,7 +2573,7 @@ export const ru = {
apiDescription: "Смотрите, что другие приложения отправляют в API этого сервера, по мере поступления.",
summary: "Активные запросы, ошибки и использование токенов",
status: "активных: {active} · недавних: {recent} · {model}",
- noModelLoaded: "модель не загружена",
+ noModelLoaded: "Модель не загружена",
autoOpen: "Автоматически показывать плавающий монитор",
autoOpenDescription:
"Открывает небольшую панель при появлении трафика API.",
@@ -2590,11 +2590,25 @@ export const ru = {
gpuUnusableDetail: "Обнаружен, но PyTorch не может его использовать",
detailedView: "Подробный вид",
detailedViewDescription:
- "Показывать загрузку CPU, а также загрузку, температуру и мощность каждой GPU в плавающем окне.",
- cpuLoad: "Загрузка CPU",
+ "Показывать загрузку, температуру и мощность каждой GPU в плавающем окне.",
gpuLoad: "Загрузка GPU",
temperature: "Температура",
power: "Мощность",
+ memory: "Память",
+ gpuInUse: "Используется GPU",
+ availableForModels: "Доступно для моделей",
+ refreshRate: "Частота обновления",
+ refreshRateDescription: "Как часто плавающий монитор считывает использование памяти и GPU, пока он открыт.",
+ refreshEvery: "Каждые {seconds} с",
+ unsloth: "Unsloth",
+ otherApps: "Другие приложения",
+ otherInUse: "Прочее",
+ freeLabel: "Свободно",
+ unslothApp: "Приложение Unsloth",
+ unslothShare: "Показывать долю Unsloth",
+ unslothShareDescription: "Делит память на занятую Unsloth, другими приложениями и свободную.",
+ modelBreakdown: "Разбивка по моделям",
+ modelBreakdownDescription: "Делит долю Unsloth на полосе памяти между загруженными моделями и остальной частью приложения.",
},
gpu: {
title: "Устройства GPU",
@@ -5228,6 +5242,7 @@ export const ru = {
monitor: {
dragHandleLabel: "Переместить живой монитор. Стрелки сдвигают его понемногу, двойной щелчок сбрасывает положение.",
reconnecting: "Повторное подключение…",
+ resizeHint: "Потяните за сторону или угол, чтобы изменить ширину. Двойной щелчок сбрасывает её.",
},
},
projectsPage: {
diff --git a/studio/frontend/src/i18n/locales/sv.ts b/studio/frontend/src/i18n/locales/sv.ts
index 839a33f2905..0f8faf3826c 100644
--- a/studio/frontend/src/i18n/locales/sv.ts
+++ b/studio/frontend/src/i18n/locales/sv.ts
@@ -2688,7 +2688,7 @@ export const sv = {
apiDescription: "Se vad andra appar skickar till den här serverns API när det kommer in.",
summary: "Begäranden, fel och tokenanvändning i realtid",
status: "{active} aktiva · {recent} senaste · {model}",
- noModelLoaded: "ingen modell inläst",
+ noModelLoaded: "Ingen modell inläst",
autoOpen: "Den flytande övervakaren öppnas automatiskt",
autoOpenDescription: "Öppnar en liten panel när API-trafik anländer.",
cpu: "CPU",
@@ -2704,11 +2704,25 @@ export const sv = {
gpuUnusableDetail: "Identifierad, men PyTorch kan inte använda den",
detailedView: "Detaljerad vy",
detailedViewDescription:
- "Visa CPU-belastning samt belastning, temperatur och effekt för varje GPU i det flytande fönstret.",
- cpuLoad: "CPU-belastning",
+ "Visa belastning, temperatur och effekt för varje GPU i det flytande fönstret.",
gpuLoad: "GPU-belastning",
temperature: "Temperatur",
power: "Effekt",
+ memory: "Minne",
+ gpuInUse: "Används av GPU",
+ availableForModels: "Tillgängligt för modeller",
+ refreshRate: "Uppdateringsfrekvens",
+ refreshRateDescription: "Hur ofta den flytande monitorn läser minnes- och GPU-användning medan den är öppen.",
+ refreshEvery: "Var {seconds} s",
+ unsloth: "Unsloth",
+ otherApps: "Andra appar",
+ otherInUse: "Övrig användning",
+ freeLabel: "Ledigt",
+ unslothApp: "Unsloth-appen",
+ unslothShare: "Visa Unsloths andel",
+ unslothShareDescription: "Delar upp minnet i det Unsloth använder, det andra appar använder och det lediga.",
+ modelBreakdown: "Dela upp per modell",
+ modelBreakdownDescription: "Delar upp Unsloths del av minnesstapeln i varje inläst modell och resten av appen.",
},
gpu: {
title: "GPU-enheter",
@@ -5444,6 +5458,7 @@ export const sv = {
monitor: {
dragHandleLabel: "Flytta liveövervakaren. Piltangenterna flyttar den lite i taget, dubbelklick återställer den.",
reconnecting: "Återansluter …",
+ resizeHint: "Dra i en sida eller ett hörn för att ändra bredden. Dubbelklicka för att återställa den.",
},
},
projectsPage: {
diff --git a/studio/frontend/src/i18n/locales/th.ts b/studio/frontend/src/i18n/locales/th.ts
index 6da9b8c13a4..db46286cd92 100644
--- a/studio/frontend/src/i18n/locales/th.ts
+++ b/studio/frontend/src/i18n/locales/th.ts
@@ -2653,6 +2653,21 @@ export const th = {
summary: "คำขอ ข้อผิดพลาด และการใช้โทเค็นแบบสด",
status: "ใช้งานอยู่ {active} · ล่าสุด {recent} · {model}",
noModelLoaded: "ไม่ได้โหลดโมเดล",
+ memory: "หน่วยความจำ",
+ gpuInUse: "GPU ที่ใช้งาน",
+ availableForModels: "ว่างสำหรับโมเดล",
+ refreshRate: "อัตราการรีเฟรช",
+ refreshRateDescription: "ความถี่ที่มอนิเตอร์แบบลอยอ่านการใช้หน่วยความจำและ GPU ขณะเปิดอยู่",
+ refreshEvery: "ทุก {seconds} วินาที",
+ unsloth: "Unsloth",
+ otherApps: "แอปอื่น",
+ otherInUse: "การใช้งานอื่น",
+ freeLabel: "ว่าง",
+ unslothApp: "แอป Unsloth",
+ unslothShare: "แสดงส่วนของ Unsloth",
+ unslothShareDescription: "แบ่งหน่วยความจำเป็นส่วนที่ Unsloth ใช้ ส่วนที่แอปอื่นใช้ และส่วนที่ว่าง",
+ modelBreakdown: "แยกตามโมเดล",
+ modelBreakdownDescription: "แบ่งส่วนของ Unsloth ในแถบหน่วยความจำออกเป็นแต่ละโมเดลที่โหลดและส่วนที่เหลือของแอป",
autoOpen: "เปิดตัวตรวจสอบแบบลอยโดยอัตโนมัติ",
autoOpenDescription: "เปิดแผงขนาดเล็กเมื่อมีทราฟฟิก API เข้ามา",
cpu: "CPU",
@@ -2668,8 +2683,7 @@ export const th = {
gpuUnusableDetail: "ตรวจพบ แต่ PyTorch ใช้งานไม่ได้",
detailedView: "มุมมองแบบละเอียด",
detailedViewDescription:
- "แสดงโหลด CPU และโหลด อุณหภูมิ และพลังงานของ GPU แต่ละตัวในหน้าต่างลอย",
- cpuLoad: "โหลด CPU",
+ "แสดงโหลด อุณหภูมิ และพลังงานของ GPU แต่ละตัวในหน้าต่างลอย",
gpuLoad: "โหลด GPU",
temperature: "อุณหภูมิ",
power: "พลังงาน",
@@ -5332,6 +5346,7 @@ export const th = {
},
monitor: {
dragHandleLabel: "ย้ายตัวตรวจสอบแบบเรียลไทม์ ใช้ปุ่มลูกศรเพื่อขยับ ดับเบิลคลิกเพื่อรีเซ็ต",
+ resizeHint: "ลากขอบหรือมุมเพื่อเปลี่ยนความกว้าง ดับเบิลคลิกเพื่อรีเซ็ต",
reconnecting: "กำลังเชื่อมต่อใหม่...",
},
},
diff --git a/studio/frontend/src/i18n/locales/tr.ts b/studio/frontend/src/i18n/locales/tr.ts
index 3841cd0eae9..bd88bd59fa6 100644
--- a/studio/frontend/src/i18n/locales/tr.ts
+++ b/studio/frontend/src/i18n/locales/tr.ts
@@ -2759,7 +2759,22 @@ export const tr = {
"Diğer uygulamaların bu sunucunun API'sine gönderdiklerini geldikleri anda görün.",
summary: "Canlı istekler, hatalar ve token kullanımı",
status: "{active} etkin · {recent} son · {model}",
- noModelLoaded: "yüklü model yok",
+ noModelLoaded: "Yüklü model yok",
+ memory: "Bellek",
+ gpuInUse: "Kullanımdaki GPU",
+ availableForModels: "Modeller için kullanılabilir",
+ refreshRate: "Yenileme hızı",
+ refreshRateDescription: "Kayan monitör açıkken bellek ve GPU kullanımını ne sıklıkla okur.",
+ refreshEvery: "Her {seconds} sn",
+ unsloth: "Unsloth",
+ otherApps: "Diğer uygulamalar",
+ otherInUse: "Diğer kullanım",
+ freeLabel: "Boş",
+ unslothApp: "Unsloth uygulaması",
+ unslothShare: "Unsloth'un payını göster",
+ unslothShareDescription: "Belleği Unsloth'un kullandığı, diğer uygulamaların kullandığı ve boş olan kısımlara ayırır.",
+ modelBreakdown: "Modele göre ayır",
+ modelBreakdownDescription: "Bellek çubuğundaki Unsloth payını yüklü her modele ve uygulamanın geri kalanına ayırır.",
autoOpen: "Kayan izleyici otomatik açılır",
autoOpenDescription: "API trafiği geldiğinde küçük bir panel açar.",
cpu: "CPU",
@@ -2775,8 +2790,7 @@ export const tr = {
gpuUnusableDetail: "Algılandı, ancak PyTorch kullanamıyor",
detailedView: "Ayrıntılı görünüm",
detailedViewDescription:
- "Kayan pencerede CPU yükünü ve her GPU'nun yükünü, sıcaklığını ve güç tüketimini gösterin.",
- cpuLoad: "CPU yükü",
+ "Kayan pencerede her GPU'nun yükünü, sıcaklığını ve güç tüketimini gösterin.",
gpuLoad: "GPU yükü",
temperature: "Sıcaklık",
power: "Güç",
@@ -5593,6 +5607,7 @@ export const tr = {
monitor: {
dragHandleLabel:
"Canlı izleyiciyi taşıyın. Ok tuşları onu kaydırır, çift tıklama sıfırlar.",
+ resizeHint: "Genişliği değiştirmek için bir kenarı veya köşeyi sürükleyin. Çift tıklama sıfırlar.",
reconnecting: "Yeniden bağlanılıyor...",
},
},
diff --git a/studio/frontend/src/i18n/locales/uk.ts b/studio/frontend/src/i18n/locales/uk.ts
index e0fd4cfa3ed..64d32496036 100644
--- a/studio/frontend/src/i18n/locales/uk.ts
+++ b/studio/frontend/src/i18n/locales/uk.ts
@@ -2788,7 +2788,22 @@ export const uk = {
"Переглядайте, що інші застосунки надсилають до API цього сервера, в міру надходження.",
summary: "Запити, помилки й використання токенів наживо",
status: "Активних: {active} · Нещодавніх: {recent} · {model}",
- noModelLoaded: "модель не завантажено",
+ noModelLoaded: "Модель не завантажено",
+ memory: "Пам'ять",
+ gpuInUse: "GPU у використанні",
+ availableForModels: "Доступно для моделей",
+ refreshRate: "Частота оновлення",
+ refreshRateDescription: "Як часто плаваючий монітор зчитує використання пам'яті та GPU, поки він відкритий.",
+ refreshEvery: "Кожні {seconds} с",
+ unsloth: "Unsloth",
+ otherApps: "Інші застосунки",
+ otherInUse: "Інше використання",
+ freeLabel: "Вільно",
+ unslothApp: "Застосунок Unsloth",
+ unslothShare: "Показувати частку Unsloth",
+ unslothShareDescription: "Розділяє пам'ять на те, що використовує Unsloth, що використовують інші застосунки, і що вільно.",
+ modelBreakdown: "Розбивка за моделями",
+ modelBreakdownDescription: "Розділяє частку Unsloth на смузі пам'яті на кожну завантажену модель і решту застосунку.",
autoOpen: "Автоматично відкривати плаваючий монітор",
autoOpenDescription:
"Відкриває невелику панель, коли надходить трафік API.",
@@ -2805,8 +2820,7 @@ export const uk = {
gpuUnusableDetail: "Виявлено, але PyTorch не може його використовувати",
detailedView: "Докладний вигляд",
detailedViewDescription:
- "Показувати в плаваючому вікні навантаження CPU, а також навантаження, температуру й споживання кожного GPU.",
- cpuLoad: "Навантаження CPU",
+ "Показувати в плаваючому вікні навантаження, температуру й споживання кожного GPU.",
gpuLoad: "Навантаження GPU",
temperature: "Температура",
power: "Споживання",
@@ -5640,6 +5654,7 @@ export const uk = {
monitor: {
dragHandleLabel:
"Перемістити монітор реального часу. Клавіші зі стрілками зсувають його, подвійне клацання скидає положення.",
+ resizeHint: "Перетягніть край або кут, щоб змінити ширину. Подвійне клацання скидає її.",
reconnecting: "Повторне підключення...",
},
},
diff --git a/studio/frontend/src/i18n/locales/vi.ts b/studio/frontend/src/i18n/locales/vi.ts
index 95076e33742..07eda64f5d2 100644
--- a/studio/frontend/src/i18n/locales/vi.ts
+++ b/studio/frontend/src/i18n/locales/vi.ts
@@ -2767,7 +2767,22 @@ export const vi = {
"Xem những gì các ứng dụng khác gửi tới API của máy chủ này ngay khi đến.",
summary: "Yêu cầu trực tiếp, lỗi và mức sử dụng token",
status: "{active} đang hoạt động · {recent} gần đây · {model}",
- noModelLoaded: "chưa nạp mô hình",
+ noModelLoaded: "Chưa nạp mô hình",
+ memory: "Bộ nhớ",
+ gpuInUse: "GPU đang dùng",
+ availableForModels: "Còn trống cho mô hình",
+ refreshRate: "Tần suất làm mới",
+ refreshRateDescription: "Tần suất màn hình nổi đọc mức dùng bộ nhớ và GPU khi đang mở.",
+ refreshEvery: "Mỗi {seconds} giây",
+ unsloth: "Unsloth",
+ otherApps: "Ứng dụng khác",
+ otherInUse: "Đang dùng khác",
+ freeLabel: "Trống",
+ unslothApp: "Ứng dụng Unsloth",
+ unslothShare: "Hiện phần của Unsloth",
+ unslothShareDescription: "Chia bộ nhớ thành phần Unsloth dùng, phần các ứng dụng khác dùng và phần còn trống.",
+ modelBreakdown: "Chia theo mô hình",
+ modelBreakdownDescription: "Chia phần của Unsloth trên thanh bộ nhớ thành từng mô hình đã tải và phần còn lại của ứng dụng.",
autoOpen: "Tự động mở trình giám sát nổi",
autoOpenDescription: "Mở một bảng nhỏ khi có lưu lượng API.",
cpu: "CPU",
@@ -2783,8 +2798,7 @@ export const vi = {
gpuUnusableDetail: "Đã phát hiện nhưng PyTorch không thể sử dụng",
detailedView: "Chế độ xem chi tiết",
detailedViewDescription:
- "Hiển thị tải CPU cùng tải, nhiệt độ và công suất của từng GPU trong cửa sổ nổi.",
- cpuLoad: "Tải CPU",
+ "Hiển thị tải, nhiệt độ và công suất của từng GPU trong cửa sổ nổi.",
gpuLoad: "Tải GPU",
temperature: "Nhiệt độ",
power: "Công suất",
@@ -5596,6 +5610,7 @@ export const vi = {
monitor: {
dragHandleLabel:
"Di chuyển bảng giám sát trực tiếp. Phím mũi tên để dịch chuyển nhẹ, nhấp đúp để đặt lại.",
+ resizeHint: "Kéo một cạnh hoặc góc để đổi chiều rộng. Nhấp đúp để đặt lại.",
reconnecting: "Đang kết nối lại...",
},
},
diff --git a/studio/frontend/src/i18n/locales/zh-CN.ts b/studio/frontend/src/i18n/locales/zh-CN.ts
index 8b92f0957b5..29a06b6ebda 100644
--- a/studio/frontend/src/i18n/locales/zh-CN.ts
+++ b/studio/frontend/src/i18n/locales/zh-CN.ts
@@ -2551,11 +2551,25 @@ export const zhCN = {
gpuUnusableDetail: "已检测到,但 PyTorch 无法使用",
detailedView: "详细视图",
detailedViewDescription:
- "在浮动窗口中显示 CPU 负载以及每个 GPU 的负载、温度和功耗。",
- cpuLoad: "CPU 负载",
+ "在浮动窗口中显示每个 GPU 的负载、温度和功耗。",
gpuLoad: "GPU 负载",
temperature: "温度",
power: "功耗",
+ memory: "内存",
+ gpuInUse: "GPU 占用",
+ availableForModels: "可用于模型",
+ refreshRate: "刷新频率",
+ refreshRateDescription: "浮动监视器打开时读取内存和 GPU 使用情况的频率。",
+ refreshEvery: "每 {seconds} 秒",
+ unsloth: "Unsloth",
+ otherApps: "其他应用",
+ otherInUse: "其他占用",
+ freeLabel: "空闲",
+ unslothApp: "Unsloth 应用",
+ unslothShare: "显示 Unsloth 占用",
+ unslothShareDescription: "将内存分为 Unsloth 占用、其他应用占用和空闲。",
+ modelBreakdown: "按模型细分",
+ modelBreakdownDescription: "在内存条中将 Unsloth 的占用拆分为每个已加载模型和应用其余部分。",
},
gpu: {
title: "GPU 设备",
@@ -5102,6 +5116,7 @@ export const zhCN = {
monitor: {
dragHandleLabel: "移动实时监控。方向键可微调位置,双击可重置。",
reconnecting: "正在重新连接...",
+ resizeHint: "拖动侧边或角落调整宽度。双击恢复。",
},
},
projectsPage: {
diff --git a/studio/frontend/src/i18n/locales/zh-TW.ts b/studio/frontend/src/i18n/locales/zh-TW.ts
index 7723d84adb3..52a2e37f836 100644
--- a/studio/frontend/src/i18n/locales/zh-TW.ts
+++ b/studio/frontend/src/i18n/locales/zh-TW.ts
@@ -2641,6 +2641,21 @@ export const zhTW = {
summary: "即時請求、錯誤和 token 用量",
status: "{active} 個進行中 · {recent} 個最近 · {model}",
noModelLoaded: "未載入模型",
+ memory: "記憶體",
+ gpuInUse: "GPU 使用中",
+ availableForModels: "可供模型使用",
+ refreshRate: "重新整理頻率",
+ refreshRateDescription: "浮動監視器開啟時讀取記憶體與 GPU 使用量的頻率。",
+ refreshEvery: "每 {seconds} 秒",
+ unsloth: "Unsloth",
+ otherApps: "其他應用程式",
+ otherInUse: "其他使用",
+ freeLabel: "可用",
+ unslothApp: "Unsloth 應用程式",
+ unslothShare: "顯示 Unsloth 的占用",
+ unslothShareDescription: "將記憶體分成 Unsloth 使用的、其他應用程式使用的,以及可用的部分。",
+ modelBreakdown: "依模型細分",
+ modelBreakdownDescription: "將記憶體條中 Unsloth 的部分細分為每個已載入的模型與應用程式其餘部分。",
autoOpen: "自動開啟浮動監控",
autoOpenDescription: "收到 API 流量時開啟一個小面板。",
cpu: "CPU",
@@ -2656,8 +2671,7 @@ export const zhTW = {
gpuUnusableDetail: "已偵測到,但 PyTorch 無法使用",
detailedView: "詳細檢視",
detailedViewDescription:
- "在浮動視窗中顯示 CPU 負載,以及每個 GPU 的負載、溫度和功耗。",
- cpuLoad: "CPU 負載",
+ "在浮動視窗中顯示每個 GPU 的負載、溫度和功耗。",
gpuLoad: "GPU 負載",
temperature: "溫度",
power: "功耗",
@@ -5289,6 +5303,7 @@ export const zhTW = {
},
monitor: {
dragHandleLabel: "移動即時監視器。可用方向鍵微調位置,按兩下可重設位置。",
+ resizeHint: "拖曳邊緣或角落以變更寬度。按兩下可重設。",
reconnecting: "正在重新連線…",
},
},
diff --git a/studio/frontend/tests/drag-costs-no-render.test.ts b/studio/frontend/tests/drag-costs-no-render.test.ts
index c4272483797..2cef9fdb895 100644
--- a/studio/frontend/tests/drag-costs-no-render.test.ts
+++ b/studio/frontend/tests/drag-costs-no-render.test.ts
@@ -52,10 +52,10 @@ test("the card hands the offset back to left/top on release", () => {
test("the monitor paints a drag frame through a transform", () => {
const panel = readSrc("hooks/use-floating-panel-layout.ts");
assert.match(panel, /monitor\.style\.transform = `translate3d\(/);
- assert.match(
- panel,
- /dragFrameRef\.current = requestAnimationFrame\(paintDrag\)/,
- );
+ // Painted in the pointer handler: a rAF deferral left the card trailing a fast pointer by 30-45 px.
+ const update = panel.slice(panel.indexOf("function updateDrag("), panel.indexOf("function finishDrag("));
+ assert.match(update, /paintDrag\(\);/);
+ assert.doesNotMatch(update, /requestAnimationFrame|set[A-Z]\w*\(/);
});
test("the monitor commits its position once, on release", () => {
diff --git a/studio/frontend/tests/floating-monitor-redesign.test.ts b/studio/frontend/tests/floating-monitor-redesign.test.ts
new file mode 100644
index 00000000000..f74387ef147
--- /dev/null
+++ b/studio/frontend/tests/floating-monitor-redesign.test.ts
@@ -0,0 +1,57 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
+
+import assert from "node:assert/strict";
+import test from "node:test";
+
+import {
+ DEFAULT_MONITOR_REFRESH_MS,
+ MONITOR_REFRESH_OPTIONS_MS,
+ monitorRefreshMs,
+} from "../src/components/monitor-refresh.ts";
+import { readSrc } from "./helpers/kit.ts";
+
+const floatingMonitor = readSrc("components/floating-monitor.tsx");
+
+test("refresh rate keeps the old 5 s default and only accepts listed intervals", () => {
+ assert.equal(DEFAULT_MONITOR_REFRESH_MS, 5000);
+ for (const ms of MONITOR_REFRESH_OPTIONS_MS) {
+ assert.equal(monitorRefreshMs(ms), ms);
+ }
+ // A 0 or junk value from storage must not turn the poll into a busy loop.
+ for (const junk of [0, -1, 1, 250, Number.NaN, "1000", null, undefined]) {
+ assert.equal(monitorRefreshMs(junk), DEFAULT_MONITOR_REFRESH_MS);
+ }
+});
+
+test("the floating monitor polls at the stored rate, not a hard-coded 5 s", () => {
+ assert.match(floatingMonitor, /pollMs: refreshMs/);
+ assert.doesNotMatch(floatingMonitor, /pollMs: 5000/);
+});
+
+test("the panel has no native resize grip: it sizes to its content", () => {
+ assert.match(floatingMonitor, /layout \? "top-0 left-0" : "right-0 bottom-0"/);
+});
+
+test("unified memory is one Memory row, not a RAM bar and a VRAM bar of the same pool", () => {
+ assert.match(floatingMonitor, /unifiedPool &&\s+memoryDisplay\.sharedDevices\.length === 0/);
+ assert.match(floatingMonitor, /liveMonitor\.memory"/);
+ assert.match(floatingMonitor, /liveMonitor\.gpuInUse"/);
+ assert.match(floatingMonitor, /liveMonitor\.availableForModels"/);
+});
+
+test("the card drags from its background, and controls and resize edges keep their pointer", () => {
+ assert.match(floatingMonitor, /event\.target\.closest\(BACKGROUND_DRAG_EXCLUDED\)/);
+ assert.match(floatingMonitor, /\[role="button"\], \[data-testid="floating-monitor-resize"\]/);
+ // The grip stays.
+ assert.match(floatingMonitor, /data-testid="floating-monitor-drag-handle"/);
+});
+
+test("at a fast refresh the GPU rows follow it instead of the backend's 10 s GPU cache", () => {
+ assert.match(floatingMonitor, /gpuFollowsPoll: true/);
+ const hook = readSrc("hooks/use-system.ts");
+ assert.match(hook, /params\.set\("gpu_max_age", String\(gpuMaxAgeMs \/ 1000\)\)/);
+ assert.match(hook, /gpuMaxAgeMs: gpuFollowsPoll \? pollMs : undefined/);
+ // Settings keeps the default cache: only the monitor opts in.
+ assert.doesNotMatch(readSrc("features/settings/tabs/resources-tab.tsx"), /gpuFollowsPoll/);
+});
diff --git a/studio/frontend/tests/floating-monitor-resize.test.ts b/studio/frontend/tests/floating-monitor-resize.test.ts
new file mode 100644
index 00000000000..395886ba374
--- /dev/null
+++ b/studio/frontend/tests/floating-monitor-resize.test.ts
@@ -0,0 +1,82 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
+
+import assert from "node:assert/strict";
+import test from "node:test";
+
+import {
+ FLOATING_PANEL_POSITION_KEYS,
+ readPanelWidth,
+ resizedWidth,
+} from "../src/hooks/floating-panel-position.ts";
+import { readSrc } from "./helpers/kit.ts";
+
+const BOUNDS = { min: 232, max: 520 };
+const PANEL = { width: 256 };
+
+test("a side edge follows the pointer, mirrored on the left", () => {
+ const right = { ...PANEL, edges: { x: 1, y: 0 } } as const;
+ const left = { ...PANEL, edges: { x: -1, y: 0 } } as const;
+ assert.equal(resizedWidth(right, 40, BOUNDS), 296);
+ assert.equal(resizedWidth(left, -40, BOUNDS), 296);
+ assert.equal(resizedWidth(left, 40, BOUNDS), 232);
+});
+
+test("a corner only changes the width: the height follows the content", () => {
+ const corner = { ...PANEL, edges: { x: 1, y: 1 } } as const;
+ assert.equal(resizedWidth(corner, 40, BOUNDS), 296);
+ const top = { ...PANEL, edges: { x: 0, y: -1 } } as const;
+ assert.equal(resizedWidth(top, 40, BOUNDS), 256);
+});
+
+test("width stays inside min and max, and the max yields to a smaller min", () => {
+ const right = { ...PANEL, edges: { x: 1, y: 0 } } as const;
+ assert.equal(resizedWidth(right, 1000, BOUNDS), 520);
+ assert.equal(resizedWidth(right, -1000, BOUNDS), 232);
+ // No room at all (a corner against the viewport edge) keeps the floor, never below it.
+ assert.equal(resizedWidth(right, 50, { min: 232, max: 100 }), 232);
+});
+
+test("a stored width is clamped, and junk is ignored", () => {
+ const store = new Map<string, string>();
+ const previous = globalThis.localStorage;
+ globalThis.localStorage = {
+ getItem: (key: string) => store.get(key) ?? null,
+ } as Storage;
+ try {
+ const options = { minWidth: 232, maxWidth: 520, defaultWidth: () => 256, storageKey: "w" };
+ assert.equal(readPanelWidth(options), null);
+ store.set("w", "300");
+ assert.equal(readPanelWidth(options), 300);
+ store.set("w", "9000");
+ assert.equal(readPanelWidth(options), 520);
+ store.set("w", "abc");
+ assert.equal(readPanelWidth(options), null);
+ assert.equal(readPanelWidth(undefined), null);
+ } finally {
+ globalThis.localStorage = previous;
+ }
+});
+
+test("the stored width is cleared with the stored positions", () => {
+ assert.equal(FLOATING_PANEL_POSITION_KEYS.liveMonitorWidth, "unsloth_live_monitor_width");
+ const monitor = readSrc("components/floating-monitor.tsx");
+ assert.match(monitor, /storageKey: FLOATING_PANEL_POSITION_KEYS\.liveMonitorWidth/);
+ assert.match(monitor, /data-edge=\{edge\}/);
+ assert.doesNotMatch(monitor, /panel-scale/);
+});
+
+test("drag, nudge and resize never run at once, and a squeezed monitor grows back to its default width", () => {
+ const hook = readSrc("hooks/use-floating-panel-layout.ts");
+ for (const name of ["startDrag", "nudge", "startResize"]) {
+ const body = hook.slice(hook.indexOf(`function ${name}(`)).slice(0, 600);
+ assert.match(body, /dragSessionRef\.current \|\|\s*resizeSessionRef\.current/, name);
+ }
+ assert.match(hook, /widthRef\.current \?\? resizeRef\.current\.defaultWidth\(\)/);
+});
+
+test("a drag never clamps the chosen width of a squeezed resizable panel", () => {
+ const hook = readSrc("hooks/use-floating-panel-layout.ts");
+ const drag = hook.slice(hook.indexOf("function startDrag("), hook.indexOf("dragSessionRef.current = {"));
+ assert.match(drag, /!resizeRef\.current &&\s*Number\.isFinite\(inlineWidth\)/);
+});
diff --git a/studio/frontend/tests/floating-panel-position.test.ts b/studio/frontend/tests/floating-panel-position.test.ts
index 38132d2cf9a..7de20903b7f 100644
--- a/studio/frontend/tests/floating-panel-position.test.ts
+++ b/studio/frontend/tests/floating-panel-position.test.ts
@@ -89,7 +89,7 @@ test("a corrupt stored spot falls back to the default placement", () => {
test("both monitors persist under their own key and a reset clears them", () => {
assert.match(
readSrc("components/floating-monitor.tsx"),
- /FLOATING_PANEL_POSITION_KEYS\.liveMonitor,\s*cornerCard,\s*\);/,
+ /FLOATING_PANEL_POSITION_KEYS\.liveMonitor,\s*cornerCard,\s*MONITOR_RESIZE,\s*\);/,
);
assert.match(
readSrc("features/api-monitor/api-monitor-overlay.tsx"),
@@ -101,10 +101,13 @@ test("both monitors persist under their own key and a reset clears them", () =>
);
});
-test("layout skips a 0x0 frame and only a drag or a nudge writes the stored spot", () => {
+test("layout skips a 0x0 frame and only a drag, a nudge or a real resize writes the stored spot", () => {
const hook = readSrc("hooks/use-floating-panel-layout.ts");
assert.match(hook, /if \(isDegenerateBox\(constraintsBox\)\) \{\s*return;/);
- assert.equal(hook.split("storePanelIntent(").length - 1, 2);
+ assert.equal(hook.split("storePanelIntent(").length - 1, 3);
+ const resize = hook.slice(hook.indexOf("function finishResize"));
+ assert.match(resize, /if \(session\.moved\)/);
+ assert.match(resize, /storePanelIntent\(storageKey, intentRef\.current\)/);
const nudge = hook.slice(hook.indexOf("function nudge("));
assert.match(nudge, /storePanelIntent\(storageKey, intentRef\.current\)/);
const finish = hook.slice(hook.indexOf("function finishDrag"));
diff --git a/studio/frontend/tests/loaded-models-sources.test.ts b/studio/frontend/tests/loaded-models-sources.test.ts
index 8a92f434f01..f0ff1717f4d 100644
--- a/studio/frontend/tests/loaded-models-sources.test.ts
+++ b/studio/frontend/tests/loaded-models-sources.test.ts
@@ -18,6 +18,7 @@ import {
withPendingLoads,
shortModelLabel,
verifyResident,
+ withServingResident,
} from "../src/features/loaded-models/loaded-models-sources.ts";
function inferenceStatus(
@@ -672,3 +673,54 @@ test("an Audio page already on a workflow the model runs is left there", () => {
label: "Audio",
});
});
+
+test("only a model known to sit on the reported GPUs counts toward VRAM", () => {
+ const gguf = (resident_on_gpu: unknown) =>
+ describeInferenceStatus(
+ inferenceStatus({
+ active_model: "unsloth/gemma-3-4b-it-GGUF",
+ is_gguf: true,
+ loaded: ["unsloth/gemma-3-4b-it-GGUF"],
+ resident_mib: 3072,
+ resident_on_gpu,
+ }),
+ )[0];
+ assert.equal(gguf(true).residentOnGpu, true);
+ assert.equal(gguf(false).residentOnGpu, false);
+ // A Vulkan run (buffers not parsed) and an older server stay unknown.
+ assert.equal(gguf(null).residentOnGpu, undefined);
+ assert.equal(gguf(undefined).residentOnGpu, undefined);
+ const image = (device: string | null) =>
+ describeDiffusionStatus({ loaded: true, repo_id: "a/b", resident_mib: 2048, device } as never)[0];
+ assert.equal(image("cuda:0").residentOnGpu, true);
+ assert.equal(image("cpu").residentOnGpu, false);
+ assert.equal(image(null).residentOnGpu, undefined);
+});
+
+test("a kept chat model takes its size from its own slot, never from a primary that answered instead", () => {
+ const [, kept] = describeInferenceStatus(
+ inferenceStatus({
+ active_model: "unsloth/gemma-3-4b-it-GGUF",
+ model_identifier: "unsloth/gemma-3-4b-it-GGUF",
+ serving: ["unsloth/gemma-3-4b-it-GGUF", "unsloth/Qwen3-4B-GGUF"],
+ serving_checkpoints: ["unsloth/gemma-3-4b-it-GGUF", "unsloth/Qwen3-4B-GGUF"],
+ }),
+ );
+ assert.equal(kept.residentMib, undefined);
+ const slot = inferenceStatus({
+ active_model: "unsloth/Qwen3-4B-GGUF",
+ model_identifier: "unsloth/Qwen3-4B-GGUF",
+ resident_mib: 2376,
+ resident_on_gpu: true,
+ });
+ const sized = withServingResident(kept, slot);
+ assert.equal(sized.residentMib, 2376);
+ assert.equal(sized.residentOnGpu, true);
+ const primary = inferenceStatus({
+ active_model: "unsloth/Qwen3-4B-GGUF",
+ model_identifier: "unsloth/gemma-3-4b-it-GGUF",
+ resident_mib: 6617,
+ });
+ assert.equal(withServingResident(kept, primary), kept);
+ assert.equal(withServingResident(kept, null), kept);
+});
diff --git a/studio/frontend/tests/memory-probe-known.test.ts b/studio/frontend/tests/memory-probe-known.test.ts
index dff795bf886..6d255514b45 100644
--- a/studio/frontend/tests/memory-probe-known.test.ts
+++ b/studio/frontend/tests/memory-probe-known.test.ts
@@ -120,3 +120,34 @@ test("resident refresh bypasses cached and in-flight pre-load memory", async ()
requests[2].resolve(new Response(null, { status: 503 }));
assert.equal(await again, null);
});
+
+test("a fast monitor poll does not join a pending fetch on the 10 s GPU cache", async () => {
+ const requests: { url: string; resolve: (response: Response) => void }[] = [];
+ const system = loadWithStubs<typeof SystemHooks>(
+ new URL("../src/hooks/use-system.ts", import.meta.url),
+ {
+ react: {},
+ "@/config/env": { refreshDeviceTypeAfterSystemInfo: () => {} },
+ "@/features/auth": {
+ authFetch: (url: string) =>
+ new Promise<Response>((resolve) => {
+ requests.push({ url, resolve });
+ }),
+ },
+ },
+ { relativePassthrough: true },
+ );
+ const settings = system.fetchSystemInfo({ force: true });
+ const monitor = system.fetchSystemInfo({ force: true, gpuMaxAgeMs: 2000 });
+ assert.equal(requests.length, 1);
+ requests[0].resolve(Response.json({ memory: { available_gb: 20 } }));
+ await settings;
+ await Promise.resolve();
+ assert.equal(requests[1].url, "/api/system?gpu_max_age=2");
+ // A pending fetch at least as fresh is shared.
+ const sharer = system.fetchSystemInfo({ force: true, gpuMaxAgeMs: 5000 });
+ assert.equal(requests.length, 2);
+ requests[1].resolve(Response.json({ memory: { available_gb: 18 } }));
+ assert.equal((await monitor)?.memory.available_gb, 18);
+ assert.equal(await sharer, await monitor);
+});
diff --git a/studio/frontend/tests/monitor-cards.test.ts b/studio/frontend/tests/monitor-cards.test.ts
new file mode 100644
index 00000000000..8802404343d
--- /dev/null
+++ b/studio/frontend/tests/monitor-cards.test.ts
@@ -0,0 +1,86 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
+
+import assert from "node:assert/strict";
+import test from "node:test";
+
+import { holdsModelsInVram, shortCardName, vramCards } from "../src/components/monitor-cards.ts";
+import type { GpuDevice } from "../src/hooks/use-system.ts";
+import { readSrc } from "./helpers/kit.ts";
+
+// GR33N as /api/system reported it (Windows ROCm): two R9700s and the iGPU, which has no usage reading.
+const r9700 = (index: number, used: number): GpuDevice =>
+ ({ index, index_kind: "physical", name: "AMD Radeon AI PRO R9700", memory_total_gb: 31.86,
+ shared_memory: false, unified_memory: false, vram_used_gb: used, vram_free_gb: 31.86 - used }) as GpuDevice;
+const igpu = { index: 2, index_kind: "physical", name: "AMD Radeon(TM) Graphics", memory_total_gb: 36.23,
+ shared_memory: true, unified_memory: true, shared_memory_host_backed_gb: 34.26 } as GpuDevice;
+
+test("an iGPU beside dedicated cards neither blanks nor pads the VRAM total", () => {
+ const devices = [r9700(0, 6.62), r9700(1, 7.73), igpu];
+ const vram = vramCards(devices, { devices });
+ assert.equal(vram.cards.length, 2);
+ assert.equal(vram.totalGb, 63.72);
+ assert.ok(Math.abs((vram.usedGb ?? 0) - 14.35) < 1e-9);
+ assert.deepEqual(vram.rows.map((row) => [row.label, row.name, row.usedGb, row.totalGb]), [
+ ["GPU 0", "AI PRO R9700", 6.62, 31.86],
+ ["GPU 1", "AI PRO R9700", 7.73, 31.86],
+ ]);
+});
+
+test("one card gets no per-card rows, and a card without a reading stays unknown", () => {
+ const one = [r9700(0, 4)];
+ assert.deepEqual(vramCards(one, { devices: one }).rows, []);
+ const blind = [{ ...r9700(0, 0), vram_used_gb: undefined }, r9700(1, 2)] as GpuDevice[];
+ const vram = vramCards(blind, { devices: blind });
+ assert.equal(vram.usedGb, null);
+ assert.equal(vram.rows[0].usedGb, null);
+});
+
+test("shared-only hosts keep their devices: there is nothing dedicated to prefer", () => {
+ assert.equal(vramCards([igpu], { devices: [igpu] }).cards.length, 1);
+});
+
+test("the floating monitor and Settings both read VRAM through vramCards", () => {
+ assert.match(readSrc("components/floating-monitor.tsx"), /vramCards\(devices, memoryDisplay\.usageGpu\)/);
+ assert.match(readSrc("features/settings/tabs/resources-tab.tsx"), /vramCards\(memoryDisplay\.usageDevices, memoryDisplay\.usageGpu\)/);
+ // Each card is a full-size MeterRow, not a smaller sub-list.
+ const monitor = readSrc("components/floating-monitor.tsx");
+ assert.match(monitor, /vram\.rows\.map\(\(row\) => \{[\s\S]*?<MeterRow[\s\S]*?testId="floating-monitor-gpu-card"/);
+ assert.doesNotMatch(monitor, /CardRows/);
+});
+
+test("card names drop the vendor prefix every row would repeat", () => {
+ assert.equal(shortCardName("NVIDIA GeForce RTX 4090"), "RTX 4090");
+ assert.equal(shortCardName("NVIDIA A100-SXM4-80GB"), "A100-SXM4-80GB");
+ assert.equal(shortCardName("Intel(R) Arc(TM) A770 Graphics"), "A770 Graphics");
+ assert.equal(shortCardName("Apple M5"), "Apple M5");
+ assert.equal(shortCardName(undefined), "GPU");
+});
+
+test("an aggregate the cards cannot split keeps its own row (Windows ROCm, #7452)", () => {
+ const blind = [r9700(0, 0), r9700(1, 0)].map((card) => ({ ...card, vram_used_gb: undefined })) as GpuDevice[];
+ const vram = vramCards(blind, { devices: blind, vram_used_gb_aggregate: 9.5 });
+ assert.equal(vram.usedGb, 9.5);
+ assert.deepEqual(vram.rows.map((row) => row.usedGb), [null, null]);
+ assert.equal(vram.showTotal, true);
+ // Every card read: the per-card rows say it all.
+ const read = [r9700(0, 4), r9700(1, 2)];
+ assert.equal(vramCards(read, { devices: read }).showTotal, false);
+ assert.equal(vramCards([r9700(0, 4)], { devices: [r9700(0, 4)] }).showTotal, true);
+ assert.match(readSrc("components/floating-monitor.tsx"), /discreteVram && \(vram\.showTotal \|\| vramSegments\)/);
+});
+
+test("an APU's carve-out keeps its models in the RAM split, in the monitor and in Settings alike", () => {
+ // Strix Halo on Windows ROCm: a reserved carve-out is dedicated memory, but it is still host RAM.
+ const apu = { ...igpu, memory_total_gb: 96, shared_memory: true } as GpuDevice;
+ assert.equal(holdsModelsInVram(vramCards([apu], { devices: [apu] }).cards), false);
+ assert.equal(holdsModelsInVram(vramCards([r9700(0, 6.62), igpu], undefined).cards), true);
+ for (const file of ["components/floating-monitor.tsx", "features/settings/tabs/resources-tab.tsx"]) {
+ assert.match(readSrc(file), /holdsModelsInVram\(vram\.cards\)/, file);
+ }
+});
+
+test("card rows use the visible ordinal the detail rows use", () => {
+ const masked = [{ ...r9700(2, 1), visible_ordinal: 0 }, { ...r9700(3, 2), visible_ordinal: 1 }] as GpuDevice[];
+ assert.deepEqual(vramCards(masked, { devices: masked }).rows.map((row) => row.label), ["GPU 0", "GPU 1"]);
+});
diff --git a/studio/frontend/tests/monitor-share.test.ts b/studio/frontend/tests/monitor-share.test.ts
new file mode 100644
index 00000000000..8ca2bff0474
--- /dev/null
+++ b/studio/frontend/tests/monitor-share.test.ts
@@ -0,0 +1,239 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
+
+import assert from "node:assert/strict";
+import test from "node:test";
+
+import {
+ inferenceGpuDisjoint,
+ memorySegments,
+ unslothPoolGb,
+ memoryShare,
+ modelBreakdown,
+ modelShares,
+ poolSplit,
+} from "../src/components/monitor-share.ts";
+import { readSrc } from "./helpers/kit.ts";
+
+test("Unsloth's share is split out of used memory and never exceeds it", () => {
+ assert.deepEqual(memoryShare(20, 32, 6), { unsloth: 6, other: 14, free: 12 });
+ // RSS can overshoot the host's used figure (shared pages): clamp, never a negative "other".
+ assert.deepEqual(memoryShare(4, 32, 6), { unsloth: 4, other: 0, free: 28 });
+ assert.equal(memoryShare(20, 0, 6), null);
+ assert.equal(memoryShare(20, 32, null), null);
+});
+
+test("models without a size are left out, largest first, labels preferred", () => {
+ const shares = modelShares([
+ { id: "a", name: "unsloth/small", residentMib: 512 },
+ { id: "b", name: "none" },
+ { id: "c", name: "repo/big", label: "Big", residentMib: 4096 },
+ ]);
+ assert.deepEqual(shares, [
+ { id: "c", name: "Big", gb: 4 },
+ { id: "a", name: "small", gb: 0.5 },
+ ]);
+});
+
+test("the app row is what is left of Unsloth's share once the models in that pool are taken out", () => {
+ const models = [{ id: "m", name: "m", gb: 4 }];
+ assert.deepEqual(modelBreakdown(6, models, true), { models, app: 2 });
+ // Discrete GPU: the models are in VRAM, so they do not come out of RAM.
+ assert.deepEqual(modelBreakdown(6, models, false), { models, app: 6 });
+ // RSS below the models (Metal buffers on Apple): no app row rather than "0.00 GiB".
+ assert.deepEqual(modelBreakdown(3, models, true), { models, app: null });
+ assert.deepEqual(modelBreakdown(null, models, true), { models, app: null });
+});
+
+test("both toggles are off by default and only poll loaded models when one is on", () => {
+ const store = readSrc("features/settings/stores/monitor-overlay-store.ts");
+ assert.match(store, /showUnslothShare: false/);
+ assert.match(store, /showModelBreakdown: false/);
+ assert.match(
+ readSrc("features/settings/tabs/resources-tab.tsx"),
+ /useLoadedModels\(\s*wantsModels,\s*wantsModels,?\s*\)/,
+ );
+ // Floating monitor: mounted only while a toggle is on, and lazy (a static import breaks the startup chunking).
+ const monitor = readSrc("components/floating-monitor.tsx");
+ assert.match(monitor, /lazy\(\(\) => import\("\.\/monitor-loaded-models"\)\)/);
+ // Not while suppressed beside Run settings: nothing shows it.
+ assert.match(monitor, /\{wantsModels && !suppressed && \(\s*<Suspense/);
+});
+
+test("Unsloth's share never reads below the models it holds in that pool", () => {
+ assert.equal(unslothPoolGb(2.26, 2.57, true), 2.57);
+ assert.equal(unslothPoolGb(4, 2.57, true), 4);
+ // Discrete GPU: the models are in VRAM, RAM is the process tree alone.
+ assert.equal(unslothPoolGb(2.26, 2.57, false), 2.26);
+ assert.equal(unslothPoolGb(null, 2.57, true), null);
+});
+
+test("the model split replaces Unsloth's segment in the same bar, other apps and free unchanged", () => {
+ const share = { unsloth: 6, other: 14, free: 12 };
+ assert.deepEqual(
+ memorySegments(share, null).map((segment) => [segment.kind, segment.gb]),
+ [["unsloth", 6], ["other", 14], ["free", 12]],
+ );
+ const models = [{ id: "m", name: "Qwen", gb: 4 }];
+ assert.deepEqual(
+ memorySegments(share, modelBreakdown(6, models, true)).map((segment) => [segment.kind, segment.gb]),
+ [["model", 4], ["app", 2], ["other", 14], ["free", 12]],
+ );
+ // No model loaded: still one "Unsloth" segment, not a lone "Unsloth Studio app".
+ assert.deepEqual(
+ memorySegments(share, modelBreakdown(6, [], true)).map((segment) => segment.kind),
+ ["unsloth", "other", "free"],
+ );
+});
+
+test("no separate By model list: the split lives in the memory legend", () => {
+ for (const file of ["components/floating-monitor.tsx", "features/settings/tabs/resources-tab.tsx"]) {
+ assert.doesNotMatch(readSrc(file), /ModelBreakdownList|liveMonitor\.byModel/);
+ }
+});
+
+test("on VRAM the rest is unattributed: Unsloth's KV cache and training land there, not in other apps", () => {
+ const share = { unsloth: 6.46, other: 10.8, free: 46.5 };
+ assert.deepEqual(
+ memorySegments(share, null, false).map((segment) => segment.kind),
+ ["unsloth", "unattributed", "free"],
+ );
+ assert.match(readSrc("components/monitor-share.ts"), /memorySegments\(vramShare, showBreakdown \? \{ models: vramModels, app: null \} : null, false\)/);
+});
+
+test("the VRAM split counts only models known to sit on the reported GPUs", () => {
+ // CPU (RSS), Vulkan or a separate inference GPU: not this pool's bytes, and the RAM bar already counts host memory.
+ const entries = [
+ { id: "gpu", name: "a/On-GPU", residentMib: 4096, residentOnGpu: true },
+ { id: "other", name: "a/Elsewhere", residentMib: 3072 },
+ ];
+ assert.deepEqual(modelShares(entries, true).map((model) => model.id), ["gpu"]);
+ assert.deepEqual(modelShares(entries).map((model) => model.id), ["gpu", "other"]);
+ for (const file of ["components/floating-monitor.tsx", "features/settings/tabs/resources-tab.tsx"]) {
+ const src = readSrc(file);
+ assert.match(src, /inferenceGpuDisjoint\(\s*systemInfo\.gpu\?\.backend,\s*separateInferenceGpu\?\.backend,?\s*\)/);
+ }
+ // "No model loaded" only when nothing is loaded, not when a model sits outside this pool.
+ assert.match(readSrc("components/monitor-share.ts"), /noModels: showBreakdown && input\.entries\.length === 0/);
+});
+
+test("a model size ahead of the memory sample is scaled into the measured share", () => {
+ // Just after a 20 GiB load, the pool still reads 5 GiB used.
+ const share = memoryShare(5, 32, 20)!;
+ const segments = memorySegments(share, modelBreakdown(null, [{ id: "m", name: "Big", gb: 20 }], true));
+ const used = segments.filter((segment) => segment.kind !== "free").reduce((sum, s) => sum + s.gb, 0);
+ assert.ok(Math.abs(used - 5) < 1e-9);
+ assert.ok(Math.abs(segments.reduce((sum, s) => sum + s.gb, 0) - 32) < 1e-9);
+ // In step, nothing is rescaled.
+ const steady = memorySegments(memoryShare(20, 32, 12)!, modelBreakdown(12, [{ id: "m", name: "A", gb: 8 }], true));
+ assert.deepEqual(steady.map((segment) => [segment.kind, segment.gb]), [["model", 8], ["app", 4], ["other", 8], ["free", 12]]);
+});
+
+test("llama.cpp on a separate, other-vendor inference GPU is not billed to the displayed cards", () => {
+ const entries = [
+ { id: "gguf", name: "a/Chat-GGUF", source: "chat", residentMib: 4096, residentOnGpu: true },
+ { id: "img", name: "a/Image", source: "image", residentMib: 2048, residentOnGpu: true },
+ ];
+ assert.deepEqual(modelShares(entries, true, true).map((model) => model.id), ["img"]);
+ assert.deepEqual(modelShares(entries, true, false).map((model) => model.id), ["gguf", "img"]);
+ // The RAM split is untouched.
+ assert.deepEqual(modelShares(entries, false, true).map((model) => model.id), ["gguf", "img"]);
+});
+
+test("a combined inference inventory that includes the displayed backend is not elsewhere", () => {
+ // get_mixed_vulkan_inference_gpu_info: llama.cpp built with CUDA and Vulkan reports the CUDA cards too.
+ assert.equal(inferenceGpuDisjoint("cuda", "cuda+vulkan"), false);
+ assert.equal(inferenceGpuDisjoint("cuda", "vulkan"), true);
+ assert.equal(inferenceGpuDisjoint("cuda", "rocm"), true);
+ assert.equal(inferenceGpuDisjoint("cuda", null), false);
+ assert.equal(inferenceGpuDisjoint(undefined, "vulkan"), false);
+});
+
+test("CPU is a core row, so Detailed view offers no CPU load option that would do nothing", async () => {
+ const { MONITOR_DETAIL_METRICS, selectedDetailMetrics } = await import("../src/components/monitor-details.ts");
+ assert.ok(!(MONITOR_DETAIL_METRICS as readonly string[]).includes("cpuLoad"));
+ // A stored selection from before still resolves to the GPU metrics it named.
+ assert.deepEqual([...selectedDetailMetrics(["cpuLoad", "gpuLoad"])], ["gpuLoad"]);
+ assert.match(readSrc("components/floating-monitor.tsx"), /testId="floating-monitor-cpu"/);
+});
+
+test("an inflated image estimate shrinks before a measured chat model does", () => {
+ // Colab L4: image status says 13.26 GiB, chat buffers 4.35 GiB, the card has 14.04 GiB of Unsloth's in use.
+ const models = modelShares(
+ [
+ { id: "img", name: "sdxl-turbo", source: "image", residentMib: 13579, residentOnGpu: true },
+ { id: "chat", name: "Qwen3-8B", source: "chat", residentMib: 4455, residentOnGpu: true },
+ ],
+ true,
+ );
+ const segments = memorySegments(memoryShare(14.04, 22.5, 14.04)!, modelBreakdown(null, models, false), false);
+ const gb = Object.fromEntries(segments.map((segment) => [segment.id, segment.gb]));
+ assert.ok(Math.abs(gb["model:chat"] - 4455 / 1024) < 1e-9);
+ assert.ok(Math.abs(gb["model:img"] - (14.04 - 4455 / 1024)) < 1e-9);
+ // Measured rows alone over the share are still scaled to fit.
+ const over = memorySegments(memoryShare(2, 8, 2)!, modelBreakdown(null, [{ ...models[1], gb: 4 }], false), false);
+ assert.ok(Math.abs(over[0].gb - 2) < 1e-9);
+});
+
+test("kept chat models are sized by routing on their checkpoint, not a public name they may share", () => {
+ assert.match(
+ readSrc("features/loaded-models/loaded-models-api.ts"),
+ /readInferenceStatus\(signal, entry\.servingCheckpoint\)/,
+ );
+});
+
+test("one split serves the floating monitor and Settings, models in the pool that holds them", () => {
+ const entries = [{ id: "a", name: "org/A-GGUF", source: "chat", residentMib: 4096, residentOnGpu: true }];
+ const base = {
+ entries, showShare: true, showBreakdown: true, inferenceGpuElsewhere: false,
+ processGb: 6, ramUsedGb: 20, ramTotalGb: 32, vramUsedGb: 10, vramTotalGb: 24,
+ };
+ const off = poolSplit({ ...base, showShare: false, showBreakdown: false, modelsInVram: true });
+ assert.deepEqual(off, { ram: null, vram: null, noModels: false });
+ const discrete = poolSplit({ ...base, modelsInVram: true });
+ assert.deepEqual(discrete.ram?.map((s) => s.kind), ["unsloth", "other", "free"]);
+ assert.deepEqual(discrete.vram?.map((s) => [s.kind, s.gb]), [["model", 4], ["unattributed", 6], ["free", 14]]);
+ const unified = poolSplit({ ...base, modelsInVram: false });
+ assert.equal(unified.vram, null);
+ assert.deepEqual(unified.ram?.map((s) => [s.kind, s.gb]), [["model", 4], ["app", 2], ["other", 14], ["free", 12]]);
+ assert.equal(poolSplit({ ...base, entries: [], modelsInVram: false }).noModels, true);
+ for (const file of ["components/floating-monitor.tsx", "features/settings/tabs/resources-tab.tsx"]) {
+ assert.match(readSrc(file), /poolSplit\(\{/, file);
+ }
+});
+
+test("an unsized loaded model leaves the VRAM bar unsplit rather than claiming Unsloth holds 0 GiB", () => {
+ const split = poolSplit({
+ entries: [{ id: "hf", name: "unsloth/Qwen3-0.6B", source: "chat" }],
+ showShare: true, showBreakdown: false, modelsInVram: true, inferenceGpuElsewhere: false,
+ processGb: 3, ramUsedGb: 20, ramTotalGb: 32, vramUsedGb: 10, vramTotalGb: 24,
+ });
+ assert.equal(split.vram, null);
+ assert.notEqual(split.ram, null);
+});
+
+test("a model whose pool is unknown (Vulkan) leaves the VRAM bar unsplit; a proven CPU one does not", () => {
+ const base = {
+ showShare: true, showBreakdown: false, modelsInVram: true, inferenceGpuElsewhere: false,
+ processGb: 3, ramUsedGb: 20, ramTotalGb: 32, vramUsedGb: 10, vramTotalGb: 24,
+ };
+ const vulkan = [{ id: "v", name: "org/V-GGUF", source: "chat", residentMib: 3072 }];
+ assert.equal(poolSplit({ ...base, entries: vulkan }).vram, null);
+ const cpu = [{ ...vulkan[0], residentOnGpu: false }];
+ assert.notEqual(poolSplit({ ...base, entries: cpu }).vram, null);
+});
+
+test("on a GPU host a proven CPU model is broken down in RAM, a GPU one in VRAM", () => {
+ const split = poolSplit({
+ entries: [
+ { id: "g", name: "org/G-GGUF", source: "chat", residentMib: 4096, residentOnGpu: true },
+ { id: "c", name: "org/C", source: "image", residentMib: 2048, residentOnGpu: false },
+ ],
+ showShare: false, showBreakdown: true, modelsInVram: true, inferenceGpuElsewhere: false,
+ processGb: 6, ramUsedGb: 20, ramTotalGb: 32, vramUsedGb: 10, vramTotalGb: 24,
+ });
+ assert.deepEqual(split.ram?.map((s) => [s.kind, s.name ?? null, s.gb]), [
+ ["model", "C", 2], ["app", null, 4], ["other", null, 14], ["free", null, 12],
+ ]);
+ assert.deepEqual(split.vram?.map((s) => [s.kind, s.gb]), [["model", 4], ["unattributed", 6], ["free", 14]]);
+});
diff --git a/studio/frontend/tests/resources-shared-memory-display.test.ts b/studio/frontend/tests/resources-shared-memory-display.test.ts
index f71b7284544..ca16765f33e 100644
--- a/studio/frontend/tests/resources-shared-memory-display.test.ts
+++ b/studio/frontend/tests/resources-shared-memory-display.test.ts
@@ -34,7 +34,8 @@ test("a pool with no dedicated VRAM shows the shared total alone, with its headr
floatingMonitor,
/hasSharedPool && memoryTotals\.dedicated === 0/,
);
- assert.match(floatingMonitor, /hasSharedPool && !unifiedPool/);
+ // The floating VRAM row counts dedicated cards only, so it never prints a "VRAM + shared" total.
+ assert.doesNotMatch(floatingMonitor, /environment\.vramWithShared/);
assert.match(
floatingMonitor,
/formatGiB\(memoryDisplay\.unifiedAvailableGb\)/,
@@ -48,6 +49,14 @@ test("the Live Monitor shows -- for RAM until the host has been read", () => {
);
assert.match(
floatingMonitor,
- /ramKnown \? `\$\{Math\.round\(ramPercent\)\}%` : "--"/,
+ /percent=\{ramKnown \? ramPercent : null\}/,
+ );
+ assert.match(floatingMonitor, /: "-- \/ --";/);
+});
+
+test("a unified pool's tile is GPU memory, not VRAM", () => {
+ assert.match(
+ resourcesTab,
+ /memoryDisplay\.sharedOnly \|\| unifiedPool\s*\?\s*"settings\.resources\.gpu\.memory"/,
);
});
diff --git a/studio/frontend/tests/system-status-verdict.test.ts b/studio/frontend/tests/system-status-verdict.test.ts
index f848ae5c965..d155386f8b3 100644
--- a/studio/frontend/tests/system-status-verdict.test.ts
+++ b/studio/frontend/tests/system-status-verdict.test.ts
@@ -128,7 +128,7 @@ test("the Environment rows wait for the same read", () => {
test("no tile fabricates a usage percentage for a host it has not read", () => {
// An unread host is not an idle one, so no tile may pass 0.
- const tiles = tabSrc.match(/<MetricTile\b[\s\S]*?\/>/g) ?? [];
+ const tiles = tabSrc.match(/<MetricTile\b[\s\S]*?(?:<\/MetricTile>|\/>)/g) ?? [];
// Count opening tags too: the optional models-disk tile may be missed by the match above.
const opened = (tabSrc.match(/<MetricTile\b/g) ?? []).length;
assert.ok(tiles.length >= 4, `the Live monitor's tiles: found ${tiles.length}`);
@@ -136,6 +136,8 @@ test("no tile fabricates a usage percentage for a host it has not read", () => {
for (const tile of tiles) {
const label = /label=\{t\("([^"]+)"\)\}/.exec(tile)?.[1] ?? "?";
const percent = /percent=\{([^}]*)\}/.exec(tile)?.[1] ?? "";
+ // A share tile draws its own bar and shows no percentage.
+ if (/showUsage=\{false\}/.test(tile) && percent === "null") continue;
assert.match(
percent,
/hostUnread \? null :|vramUsageKnown \? metrics\.vramPercent : null/,
diff --git a/studio/frontend/tests/vram-total-gib-suffix.test.ts b/studio/frontend/tests/vram-total-gib-suffix.test.ts
index d5bbae60a82..3b8c74a28c4 100644
--- a/studio/frontend/tests/vram-total-gib-suffix.test.ts
+++ b/studio/frontend/tests/vram-total-gib-suffix.test.ts
@@ -49,8 +49,9 @@ test("VRAM and RAM totals are labelled GiB, not GB", () => {
);
});
+// The floating monitor formats through monitor-memory.tsx.
const HELPER_RENDERERS = [
- "components/floating-monitor.tsx",
+ "components/monitor-memory.tsx",
"features/settings/tabs/resources-tab.tsx",
];
diff --git a/tests/studio/playwright_chat_ui.py b/tests/studio/playwright_chat_ui.py
index fe576d2f49d..d3ee3ae08be 100644
--- a/tests/studio/playwright_chat_ui.py
+++ b/tests/studio/playwright_chat_ui.py
@@ -744,7 +744,7 @@ def parse_rgb(s):
def exercise_floating_monitor_geometry(page):
- """Exercise content, drag, native resize, and viewport geometry."""
+ """Exercise content, drag, edge resize, and viewport geometry."""
monitor = page.get_by_test_id("floating-monitor")
monitor.wait_for(state = "visible", timeout = 10_000)
monitor_handle = page.get_by_test_id("floating-monitor-drag-handle")
@@ -789,20 +789,31 @@ def exercise_floating_monitor_geometry(page):
)
return monitor_box("drag")
- def resize_monitor_to(
- x,
- y,
- grip_inset = 8,
+ def resize_handle_center(edge):
+ handle = monitor.locator(f'[data-testid="floating-monitor-resize"][data-edge="{edge}"]')
+ box = handle.bounding_box()
+ if box is None:
+ fail(f"floating monitor {edge} resize handle has no bounding box")
+ return box["x"] + box["width"] / 2, box["y"] + box["height"] / 2
+
+ def resize_monitor_by(
+ dx,
+ dy,
+ edge = "se",
):
before = monitor_box("resize")
- pointer_drag(
- before["x"] + before["width"] - grip_inset,
- before["y"] + before["height"] - grip_inset,
- x,
- y,
- )
+ start_x, start_y = resize_handle_center(edge)
+ pointer_drag(start_x, start_y, start_x + dx, start_y + dy)
return before, monitor_box("resize")
+ def content_fits(label):
+ clipped = monitor.get_by_test_id("floating-monitor-content").evaluate(
+ "node => node.getBoundingClientRect().height"
+ " - node.parentElement.getBoundingClientRect().height"
+ )
+ if abs(clipped) > tolerance:
+ fail(f"{label}: content and its scroll region differ by {clipped!r}px")
+
def expect_close(actual, expected, label):
if abs(actual - expected) > tolerance:
fail(f"{label}: expected {expected!r}, got {actual!r}")
@@ -907,13 +918,37 @@ def exercise_floating_monitor_geometry(page):
),
)
- # Chromium retains a blocked inline resize request; a later drag must not reveal that hidden size.
- _, blocked_box = resize_monitor_to(
- viewport["width"] - 2,
- viewport["height"] - 2,
- )
+ # At the resting corner the right and bottom edges have no room, so an outward drag changes nothing.
+ _, blocked_box = resize_monitor_by(40, 40)
expect_close(blocked_box["width"], initial_box["width"], "blocked width")
expect_close(blocked_box["height"], initial_box["height"], "blocked height")
+
+ # The left edge grows the card leftward while it stays pinned to the corner.
+ _, left_grown = resize_monitor_by(-60, 0, edge = "w")
+ expect_close(left_grown["width"], initial_box["width"] + 60, "left edge width")
+ expect_close(
+ left_grown["x"] + left_grown["width"],
+ viewport["width"] - inset,
+ "left edge keeps right inset",
+ )
+ expect_close(
+ left_grown["y"] + left_grown["height"],
+ viewport["height"] - inset,
+ "left edge keeps bottom inset",
+ )
+ content_fits("left edge resize")
+ # Double-click on a handle restores the default width at the same corner.
+ start_x, start_y = resize_handle_center("w")
+ page.mouse.dblclick(start_x, start_y)
+ wait_for_settled(monitor)
+ initial_box = wait_for_box(
+ "width reset",
+ lambda box: (
+ abs(box["width"] - initial_box["width"]) <= tolerance
+ and abs(box["height"] - initial_box["height"]) <= tolerance
+ and abs(box["y"] + box["height"] - viewport["height"] + inset) <= tolerance
+ ),
+ )
left_box = drag_monitor_to(0, viewport["height"] / 2)
expect_close(left_box["x"], inset, "left inset")
expect_close(left_box["width"], initial_box["width"], "post-drag width")
@@ -953,75 +988,32 @@ def exercise_floating_monitor_geometry(page):
wait_for_settled(monitor)
wait_for_box("viewport restore", lambda box: is_inside(box, viewport))
+ # Width is the one user-set size: the text stays its size and the height follows the content,
+ # so a corner drag never adds empty space below it.
resize_start = drag_monitor_to(0, 0)
- want = (resize_start["width"] + 40, resize_start["height"] + 30)
-
- def size_limits():
- return monitor.evaluate(
- """(el) => {
- const s = getComputedStyle(el);
- const px = (v) => (v === "none" ? Infinity : parseFloat(v));
- return { minWidth: px(s.minWidth), maxWidth: px(s.maxWidth), minHeight: px(s.minHeight),
- maxHeight: px(s.maxHeight), inline: el.style.cssText };
- }"""
- )
-
- # max-width/height are the room left of the panel's spot, so wait for them to allow the target before dragging.
- deadline = time.time() + 5
- limits = size_limits()
- while (
- limits["maxWidth"] < want[0] or limits["maxHeight"] < want[1]
- ) and time.time() < deadline:
- page.wait_for_timeout(50)
- limits = size_limits()
- if limits["maxWidth"] < want[0] or limits["maxHeight"] < want[1]:
- fail(
- f"floating monitor limits never left the narrow viewport after the restore: {limits!r}"
- )
- _, resized_box = resize_monitor_to(
- resize_start["x"] + resize_start["width"] - 8 + 40,
- resize_start["y"] + resize_start["height"] - 8 + 30,
- )
- if (
- abs(resized_box["width"] - want[0]) > tolerance
- or abs(resized_box["height"] - want[1]) > tolerance
- ):
- info(
- f"resize landed at {resized_box['width']}x{resized_box['height']} with limits {size_limits()!r}"
- )
+ _, resized_box = resize_monitor_by(40, 40)
expect_close(resized_box["width"], resize_start["width"] + 40, "resize width")
- expect_close(resized_box["height"], resize_start["height"] + 30, "resize height")
+ if resized_box["height"] > resize_start["height"] + tolerance:
+ fail(f"a wider card grew taller: {resize_start!r} -> {resized_box!r}")
expect_close(resized_box["x"], resize_start["x"], "resize left edge")
expect_close(resized_box["y"], resize_start["y"], "resize top edge")
+ content_fits("corner resize")
- _, minimum_box = resize_monitor_to(
- resized_box["x"] + resized_box["width"] - 102,
- resized_box["y"] + resized_box["height"] - 102,
- grip_inset = 2,
- )
- expect_close(minimum_box["width"], resize_start["width"], "minimum width")
- expect_close(minimum_box["height"], resize_start["height"], "minimum height")
+ _, minimum_box = resize_monitor_by(-200, 0)
+ expect_close(minimum_box["width"], 232, "minimum width")
+ content_fits("minimum resize")
drag_monitor_to(0, 0)
- _, maximum_box = resize_monitor_to(
- viewport["width"] - 2,
- viewport["height"] - 2,
- )
- expect_close(
- maximum_box["x"] + maximum_box["width"],
- viewport["width"] - inset,
- "maximum resize right inset",
- )
- expect_close(
- maximum_box["y"] + maximum_box["height"],
- viewport["height"] - inset,
- "maximum resize bottom inset",
- )
+ _, maximum_box = resize_monitor_by(viewport["width"], 0)
+ expect_close(maximum_box["width"], 520, "maximum width")
+ if not is_inside(maximum_box, viewport):
+ fail(f"maximum resize left the viewport: {maximum_box!r}")
+ content_fits("maximum resize")
monitor.get_by_role("button", name = "Close").click()
monitor.wait_for(state = "hidden")
info(
- "OK floating monitor preserves native resize and stays stable across "
+ "OK floating monitor resizes from its edges and stays stable across "
"content, drag, and viewport changes"
)