Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Studio: show Vulkan iGPU memory as shared availability (#11305)
oobabooga857f68d1e375
diff --git a/studio/frontend/src/components/floating-monitor.tsx b/studio/frontend/src/components/floating-monitor.tsxindex ae1db35d8db..9577967bb43 100644--- a/studio/frontend/src/components/floating-monitor.tsx+++ b/studio/frontend/src/components/floating-monitor.tsx@@ -9,6 +9,7 @@ import {useMonitorFrameStore,useMonitorOverlayStore,} from "@/features/settings";+import { gpuMemoryDisplay } from "@/hooks/gpu-memory-display";import { gpuMemoryTotalsGb, resolveGpuVramUsedGb } from "@/hooks/gpu-vram";import { aggregateGpuMemoryTotalGb, useSystemInfo } from "@/hooks/use-system";import { useT } from "@/i18n";@@ -460,16 +461,18 @@ function FloatingMonitorPanel({systemInfo.inference_gpu.backend !== systemInfo.gpu.backend? systemInfo.inference_gpu: null;+ const memoryDisplay = gpuMemoryDisplay(displayedGpu);+ const inferenceDisplay = gpuMemoryDisplay(separateInferenceGpu);const inferenceVramTotal = separateInferenceGpu- ? aggregateGpuMemoryTotalGb(separateInferenceGpu.devices)+ ? aggregateGpuMemoryTotalGb(inferenceDisplay.usageDevices): 0;- const devices = displayedGpu?.devices ?? [];+ const devices = memoryDisplay.usageDevices;const memoryTotals = gpuMemoryTotalsGb(devices);const vramTotal = memoryTotals.total;const hasSharedPool = memoryTotals.shared > 0;// null usage = unknown (e.g. Windows ROCm perf counter); 0 would fabricate a// readout. The host figure can still be known when no device's is (#7452).- const resolvedVramUsed = resolveGpuVramUsedGb(displayedGpu);+ const resolvedVramUsed = resolveGpuVramUsedGb(memoryDisplay.usageGpu);const vramUsageKnown = resolvedVramUsed !== null;const vramUsed = resolvedVramUsed ?? 0;const vramPercent = clampPercent(@@ -477,7 +480,9 @@ function FloatingMonitorPanel({);const unknownLabel = t("settings.resources.environment.unknown");- const hasGpu = (displayedGpu?.available ?? false) && devices.length > 0;+ const hasGpu =+ (displayedGpu?.available ?? false) &&+ (displayedGpu?.devices.length ?? 0) > 0;// 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, so the two can overlap. The@@ -574,7 +579,7 @@ function FloatingMonitorPanel({/></div>- {hasGpu && (+ {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">@@ -610,18 +615,51 @@ function FloatingMonitorPanel({/></div>)}+ {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">+ {t("settings.resources.gpu.estimatedAvailable", {+ value:+ memoryDisplay.sharedAvailableGb === null+ ? unknownLabel+ : formatGiB(memoryDisplay.sharedAvailableGb),+ })}+ </div>+ </div>+ )}{separateInferenceGpu && (- <div className="flex justify-between gap-2 text-ui-11 font-mono">- <span className="text-muted-foreground">+ <div className="space-y-1 border-t border-border/60 pt-2 text-ui-11">+ <span className="block font-medium text-muted-foreground">{t("settings.resources.gpu.ggufInference")}</span>- <span className="uppercase text-foreground">- {separateInferenceGpu.backend ?? "GPU"}- {separateInferenceGpu.available- ? inferenceVramTotal- ? ` · ${formatGiB(inferenceVramTotal)}`- : ""- : ` · ${t("settings.resources.gpu.unavailable")}`}+ <span className="block font-mono text-foreground">+ {separateInferenceGpu.backend?.toUpperCase() ?? "GPU"}+ {separateInferenceGpu.available ? (+ inferenceVramTotal ? (+ <span className="block">+ {t("settings.resources.gpu.vramUtilization")}:{" "}+ {formatGiB(inferenceVramTotal)}+ </span>+ ) : (+ ""+ )+ ) : (+ ` · ${t("settings.resources.gpu.unavailable")}`+ )}+ {separateInferenceGpu.available &&+ inferenceDisplay.sharedDevices.length > 0 && (+ <span className="block normal-case">+ {t("settings.resources.gpu.sharedEstimatedAvailable", {+ value:+ inferenceDisplay.sharedAvailableGb === null+ ? unknownLabel+ : formatGiB(inferenceDisplay.sharedAvailableGb),+ })}+ </span>+ )}</span></div>)}diff --git a/studio/frontend/src/features/settings/tabs/resources-tab.tsx b/studio/frontend/src/features/settings/tabs/resources-tab.tsxindex e2fa569ec54..eafafa6037d 100644--- a/studio/frontend/src/features/settings/tabs/resources-tab.tsx+++ b/studio/frontend/src/features/settings/tabs/resources-tab.tsx@@ -11,6 +11,11 @@ import {openModelsDir,pickHuggingFaceCacheDir,} from "@/features/native-intents";+import {+ gpuMemoryDisplay,+ hasSharedMemoryHeadroom,+ sharedMemoryAvailableGb,+} from "@/hooks/gpu-memory-display";import {gpuMemoryTotalsGb,gpuVramUsedIsPerDevice,@@ -112,6 +117,8 @@ function MetricTile({value,detail,percent,+ showUsage = true,+ extraDetail,}: {label: string;value: string;@@ -119,6 +126,8 @@ function MetricTile({// null = usage unknown (e.g. Windows ROCm perf counter): show a dash and// empty bar rather than a fabricated 0%.percent: number | null;+ showUsage?: boolean;+ extraDetail?: string;}) {const percentKnown = isFiniteNumber(percent);const safePercent = clampPercent(percent);@@ -128,16 +137,18 @@ function MetricTile({<span className="truncate text-ui-11 font-semibold uppercase tracking-[0.08em] text-muted-foreground">{label}</span>- <span- className={cn(- "shrink-0 font-mono text-xs tabular-nums",- percentKnown- ? usageTextClass(safePercent)- : "text-muted-foreground",- )}- >- {percentKnown ? formatPercent(safePercent) : "--"}- </span>+ {showUsage && (+ <span+ className={cn(+ "shrink-0 font-mono text-xs tabular-nums",+ percentKnown+ ? usageTextClass(safePercent)+ : "text-muted-foreground",+ )}+ >+ {percentKnown ? formatPercent(safePercent) : "--"}+ </span>+ )}</div>{/* Both lines truncate, so carry the full text: the GPU states are sentences. */}<div className="min-w-0">@@ -147,16 +158,26 @@ function MetricTile({>{value}</div>- <div title={detail} className="mt-0.5 truncate text-xs text-muted-foreground">+ <div+ title={detail}+ className="mt-0.5 truncate text-xs text-muted-foreground"+ >{detail}</div></div>- <Progress- value={percentKnown ? safePercent : 0}- aria-label={label}- className="h-1.5 rounded-full bg-muted dark:bg-black/40"- indicatorClassName={usageIndicatorClass(safePercent)}- />+ {showUsage && (+ <Progress+ value={percentKnown ? safePercent : 0}+ aria-label={label}+ className="h-1.5 rounded-full bg-muted dark:bg-black/40"+ indicatorClassName={usageIndicatorClass(safePercent)}+ />+ )}+ {extraDetail && (+ <div className="whitespace-pre-line text-xs text-muted-foreground">+ {extraDetail}+ </div>+ )}</div>);}@@ -241,8 +262,10 @@ export function ResourcesTab() {systemInfo.inference_gpu.backend !== systemInfo.gpu.backend? systemInfo.inference_gpu: null;+ const memoryDisplay = gpuMemoryDisplay(displayedGpu);+ const inferenceDisplay = gpuMemoryDisplay(separateInferenceGpu);const inferenceVramTotal = separateInferenceGpu- ? aggregateGpuMemoryTotalGb(separateInferenceGpu.devices)+ ? aggregateGpuMemoryTotalGb(inferenceDisplay.usageDevices): 0;useEffect(() => {@@ -271,16 +294,18 @@ export function ResourcesTab() {const diskFree = systemInfo.disk?.free_gb ?? 0;const diskUsed = Math.max(0, diskTotal - diskFree);const diskPercent = diskTotal > 0 ? (diskUsed / diskTotal) * 100 : 0;- const gpuMemoryTotals = gpuMemoryTotalsGb(devices);+ const display = gpuMemoryDisplay(displayedGpu);+ const usageDevices = display.usageDevices;+ const gpuMemoryTotals = gpuMemoryTotalsGb(usageDevices);const vramTotal = gpuMemoryTotals.total;// null usage = unknown (e.g. Windows ROCm perf counter); 0 would fabricate a// total, so the device's own row stays unknown. The host figure can still be// known when no device's is (#7452).- const perDeviceKnown = gpuVramUsedIsPerDevice(devices);- const vramUsed = resolveGpuVramUsedGb(displayedGpu);+ const perDeviceKnown = gpuVramUsedIsPerDevice(usageDevices);+ const vramUsed = resolveGpuVramUsedGb(display.usageGpu);const vramUsageKnown = vramUsed !== null;const vramFree = perDeviceKnown- ? devices.reduce(+ ? usageDevices.reduce((sum, device) =>sum +(device.vram_free_gb ??@@ -523,14 +548,25 @@ export function ResourcesTab() {percent={hostUnread ? null : metrics.diskPercent}/><MetricTile- label={t("settings.resources.liveMonitor.vram")}+ label={t(+ memoryDisplay.sharedOnly+ ? "settings.resources.gpu.memory"+ : "settings.resources.liveMonitor.vram",+ )}value={gpuUnknown? unknownLabel: hasGpu- ? metrics.vramUsageKnown- ? `${formatGiB(metrics.vramUsed)} / ${vramCapacityLabel}`- : `${unknownLabel} / ${vramCapacityLabel}`+ ? memoryDisplay.sharedOnly+ ? t("settings.resources.gpu.estimatedAvailable", {+ value:+ memoryDisplay.sharedAvailableGb === null+ ? unknownLabel+ : formatGiB(memoryDisplay.sharedAvailableGb),+ })+ : metrics.vramUsageKnown+ ? `${formatGiB(metrics.vramUsed)} / ${vramCapacityLabel}`+ : `${unknownLabel} / ${vramCapacityLabel}`: gpuMismatch? t("settings.resources.liveMonitor.gpuUnusable"): t("settings.resources.liveMonitor.noGpu")@@ -539,15 +575,24 @@ export function ResourcesTab() {gpuUnknown? gpuUnknownLabel: hasGpu- ? metrics.vramUsageKnown- ? t("settings.resources.liveMonitor.free", {- value: formatGiB(metrics.vramFree),- })- : unknownLabel+ ? memoryDisplay.sharedOnly+ ? t("settings.resources.gpu.sharedWithSystemRam")+ : metrics.vramUsageKnown+ ? t("settings.resources.liveMonitor.free", {+ value: formatGiB(metrics.vramFree),+ })+ : unknownLabel: gpuMismatch? t("settings.resources.liveMonitor.gpuUnusableDetail"): backendLabel}+ showUsage={!memoryDisplay.sharedOnly}+ extraDetail={+ !memoryDisplay.sharedOnly &&+ memoryDisplay.sharedDevices.length > 0+ ? `${t("settings.resources.gpu.sharedWithSystemRam")}\n${t("settings.resources.gpu.estimatedAvailable", { value: memoryDisplay.sharedAvailableGb === null ? unknownLabel : formatGiB(memoryDisplay.sharedAvailableGb) })}`+ : undefined+ }percent={metrics.vramUsageKnown ? metrics.vramPercent : null}/></div>@@ -586,13 +631,31 @@ export function ResourcesTab() {<span className="text-muted-foreground">{t("settings.resources.gpu.ggufInference")}</span>- <span className="text-right font-mono text-xs uppercase text-foreground">- {separateInferenceGpu.backend ?? "GPU"}- {separateInferenceGpu.available- ? inferenceVramTotal- ? ` · ${formatGiB(inferenceVramTotal)}`- : ""- : ` · ${t("settings.resources.gpu.unavailable")}`}+ <span className="text-right font-mono text-xs text-foreground">+ {separateInferenceGpu.backend?.toUpperCase() ?? "GPU"}+ {separateInferenceGpu.available ? (+ inferenceVramTotal ? (+ <span className="block">+ {t("settings.resources.gpu.vramUtilization")}:{" "}+ {formatGiB(inferenceVramTotal)}+ </span>+ ) : (+ ""+ )+ ) : (+ ` · ${t("settings.resources.gpu.unavailable")}`+ )}+ {separateInferenceGpu.available &&+ inferenceDisplay.sharedDevices.length > 0 && (+ <span className="block normal-case">+ {t("settings.resources.gpu.sharedEstimatedAvailable", {+ value:+ inferenceDisplay.sharedAvailableGb === null+ ? unknownLabel+ : formatGiB(inferenceDisplay.sharedAvailableGb),+ })}+ </span>+ )}</span></div>)}@@ -648,10 +711,16 @@ export function ResourcesTab() {</span>{/* Same accent pill as the New tags, which stays legibleon the light background. */}- <span className="shrink-0 rounded-full bg-control-accent/10 px-2 py-1 text-ui-10 leading-none font-semibold tabular-nums text-control-accent">- {percentText}{" "}- {t("settings.resources.gpu.vramUtilization")}- </span>+ {hasSharedMemoryHeadroom(device) ? (+ <span className="text-xs text-muted-foreground">+ {t("settings.resources.gpu.sharedWithSystemRam")}+ </span>+ ) : (+ <span className="shrink-0 rounded-full bg-control-accent/10 px-2 py-1 text-ui-10 leading-none font-semibold tabular-nums text-control-accent">+ {percentText}{" "}+ {t("settings.resources.gpu.vramUtilization")}+ </span>+ )}</div></div>{/* Meter under the figures, so it spans their width instead of@@ -659,34 +728,51 @@ export function ResourcesTab() {Model downloads control, so both blocks start on one edge.Below 992px the dialog stops filling its 960px cap and thedevice name would truncate, so the row stacks instead. */}- <div className="flex w-[392px] shrink-0 flex-col items-stretch gap-2.5 max-[992px]:w-full">- {/* Ruled between the three readings: run together they are+ {hasSharedMemoryHeadroom(device) ? (+ <div className="text-xs font-mono text-muted-foreground">+ {t("settings.resources.gpu.estimatedAvailable", {+ value:+ sharedMemoryAvailableGb([device]) === null+ ? unknownLabel+ : formatGiB(device.vram_free_gb),+ })}+ </div>+ ) : (+ <div className="flex w-[392px] shrink-0 flex-col items-stretch gap-2.5 max-[992px]:w-full">+ {/* Ruled between the three readings: run together they areeasy to misread as one number. */}- {/* min-w-0 on each reading, or truncate cannot fire: a flex+ {/* min-w-0 on each reading, or truncate cannot fire: a flexitem defaults to min-width:auto and the longest localeswould push past the block instead of ellipsizing. */}- <div className="flex items-center justify-between gap-3 font-mono text-ui-11 tabular-nums text-muted-foreground">- <span className="min-w-0 truncate">- {t("settings.resources.gpu.used", { value: usedText })}- </span>- <span aria-hidden className="h-3 w-px shrink-0 bg-border" />- <span className="min-w-0 truncate">- {t("settings.resources.gpu.free", { value: freeText })}- </span>- <span aria-hidden className="h-3 w-px shrink-0 bg-border" />- <span className="min-w-0 truncate">- {t("settings.resources.gpu.total", {- value: totalText,- })}- </span>+ <div className="flex items-center justify-between gap-3 font-mono text-ui-11 tabular-nums text-muted-foreground">+ <span className="min-w-0 truncate">+ {t("settings.resources.gpu.used", { value: usedText })}+ </span>+ <span+ aria-hidden+ className="h-3 w-px shrink-0 bg-border"+ />+ <span className="min-w-0 truncate">+ {t("settings.resources.gpu.free", { value: freeText })}+ </span>+ <span+ aria-hidden+ className="h-3 w-px shrink-0 bg-border"+ />+ <span className="min-w-0 truncate">+ {t("settings.resources.gpu.total", {+ value: totalText,+ })}+ </span>+ </div>+ <Progress+ value={safePercent}+ aria-label={device.name ?? "GPU"}+ className="h-1.5 w-full rounded-full bg-muted dark:bg-black/40"+ indicatorClassName={usageIndicatorClass(safePercent)}+ /></div>- <Progress- value={safePercent}- aria-label={device.name ?? "GPU"}- className="h-1.5 w-full rounded-full bg-muted dark:bg-black/40"- indicatorClassName={usageIndicatorClass(safePercent)}- />- </div>+ )}</div>);})diff --git a/studio/frontend/src/hooks/gpu-memory-display.ts b/studio/frontend/src/hooks/gpu-memory-display.tsnew file mode 100644index 00000000000..5d7d6323ba4--- /dev/null+++ b/studio/frontend/src/hooks/gpu-memory-display.ts@@ -0,0 +1,48 @@+// 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 type { GpuDevice, SystemGpuInfo } from "./use-system";++/** Vulkan shared devices report allocation headroom, not a fixed VRAM pool. */+export function hasSharedMemoryHeadroom(device: GpuDevice): boolean {+ return device.index_kind === "vulkan" && device.shared_memory === true;+}++export function sharedMemoryAvailableGb(devices: GpuDevice[]): number | null {+ if (+ !devices.length ||+ devices.some(+ (device) =>+ !Number.isFinite(device.vram_free_gb) ||+ (device.vram_free_gb as number) < 0,+ )+ )+ return null;+ // Multiple iGPUs are views of the same host pool, not additive capacity.+ return Math.max(...devices.map((device) => device.vram_free_gb as number));+}++/** Presentation only. Keep allocation budgets and model-fit capacity unchanged. */+export function gpuMemoryDisplay(gpu: SystemGpuInfo | null | undefined) {+ const devices = gpu?.devices ?? [];+ const sharedDevices = devices.filter(hasSharedMemoryHeadroom);+ const usageDevices = devices.filter(+ (device) => !hasSharedMemoryHeadroom(device),+ );+ return {+ sharedDevices,+ usageDevices,+ sharedOnly: sharedDevices.length > 0 && usageDevices.length === 0,+ sharedAvailableGb: sharedMemoryAvailableGb(sharedDevices),+ usageGpu: gpu+ ? {+ ...gpu,+ devices: usageDevices,+ // A host aggregate cannot be attributed to a filtered subset of its devices.+ vram_used_gb_aggregate: sharedDevices.length+ ? null+ : gpu.vram_used_gb_aggregate,+ }+ : gpu,+ };+}diff --git a/studio/frontend/src/i18n/locales/ar.ts b/studio/frontend/src/i18n/locales/ar.tsindex 02d2f8c1008..c09da9b132f 100644--- a/studio/frontend/src/i18n/locales/ar.ts+++ b/studio/frontend/src/i18n/locales/ar.ts@@ -1259,7 +1259,11 @@ export const ar = {},gpu: {title: "أجهزة GPU",- ggufInference: "استدلال GGUF",+ memory: "ذاكرة GPU",+ sharedWithSystemRam: "مشتركة مع ذاكرة النظام",+ estimatedAvailable: "المتاح تقديريًا: {value}",+ sharedEstimatedAvailable: "ذاكرة النظام المشتركة: المتاح تقديريًا {value}",+ ggufInference: "ذاكرة نماذج GGUF",unavailable: "غير متاح",detecting: "جارٍ البحث عن وحدات GPU...",unreadable: "تعذّرت قراءة عتاد هذا الخادم.",diff --git a/studio/frontend/src/i18n/locales/de.ts b/studio/frontend/src/i18n/locales/de.tsindex 2ba3d9243fa..5b9f7830245 100644--- a/studio/frontend/src/i18n/locales/de.ts+++ b/studio/frontend/src/i18n/locales/de.ts@@ -1285,7 +1285,11 @@ export const de = {},gpu: {title: "GPU-Geräte",- ggufInference: "GGUF-Inferenz",+ memory: "GPU-Speicher",+ sharedWithSystemRam: "Mit dem System-RAM geteilt",+ estimatedAvailable: "Geschätzt verfügbar: {value}",+ sharedEstimatedAvailable: "Gemeinsamer System-RAM: geschätzt {value} verfügbar",+ ggufInference: "Speicher für GGUF-Modelle",unavailable: "nicht verfügbar",detecting: "Suche nach GPUs...",unreadable: "Die Hardware dieses Servers konnte nicht gelesen werden.",diff --git a/studio/frontend/src/i18n/locales/en.ts b/studio/frontend/src/i18n/locales/en.tsindex af60d2943cc..831cc81ae73 100644--- a/studio/frontend/src/i18n/locales/en.ts+++ b/studio/frontend/src/i18n/locales/en.ts@@ -1258,7 +1258,11 @@ export const en = {},gpu: {title: "GPU devices",- ggufInference: "GGUF inference",+ memory: "GPU memory",+ sharedWithSystemRam: "Shared with system RAM",+ estimatedAvailable: "Estimated available: {value}",+ sharedEstimatedAvailable: "Shared system RAM: estimated {value} available",+ ggufInference: "GGUF model memory",unavailable: "unavailable",detecting: "Checking for GPUs...",unreadable: "Could not read this server's hardware.",diff --git a/studio/frontend/src/i18n/locales/es.ts b/studio/frontend/src/i18n/locales/es.tsindex 735d52db464..a0b5cbcfd4e 100644--- a/studio/frontend/src/i18n/locales/es.ts+++ b/studio/frontend/src/i18n/locales/es.ts@@ -1280,7 +1280,11 @@ export const es = {},gpu: {title: "Dispositivos GPU",- ggufInference: "Inferencia GGUF",+ memory: "Memoria GPU",+ sharedWithSystemRam: "Compartida con la RAM del sistema",+ estimatedAvailable: "Disponible estimado: {value}",+ sharedEstimatedAvailable: "RAM compartida del sistema: disponibilidad estimada de {value}",+ ggufInference: "Memoria para modelos GGUF",unavailable: "No disponible",detecting: "Buscando GPU...",unreadable: "No se pudo leer el hardware de este servidor.",diff --git a/studio/frontend/src/i18n/locales/fr.ts b/studio/frontend/src/i18n/locales/fr.tsindex 85882feeba4..8375013c692 100644--- a/studio/frontend/src/i18n/locales/fr.ts+++ b/studio/frontend/src/i18n/locales/fr.ts@@ -1284,7 +1284,11 @@ export const fr = {},gpu: {title: "Périphériques GPU",- ggufInference: "Inférence GGUF",+ memory: "Mémoire GPU",+ sharedWithSystemRam: "Partagée avec la RAM système",+ estimatedAvailable: "Disponibilité estimée : {value}",+ sharedEstimatedAvailable: "RAM système partagée : disponibilité estimée de {value}",+ ggufInference: "Mémoire pour les modèles GGUF",unavailable: "indisponible",detecting: "Recherche de GPU...",unreadable: "Impossible de lire le matériel de ce serveur.",diff --git a/studio/frontend/src/i18n/locales/hi.ts b/studio/frontend/src/i18n/locales/hi.tsindex ac40e2c47a2..6ac3a496b15 100644--- a/studio/frontend/src/i18n/locales/hi.ts+++ b/studio/frontend/src/i18n/locales/hi.ts@@ -1262,7 +1262,11 @@ export const hi = {},gpu: {title: "GPU डिवाइस",- ggufInference: "GGUF इन्फ़रेंस",+ memory: "GPU मेमोरी",+ sharedWithSystemRam: "सिस्टम RAM के साथ साझा",+ estimatedAvailable: "अनुमानित उपलब्ध: {value}",+ sharedEstimatedAvailable: "साझा सिस्टम RAM: अनुमानित उपलब्ध {value}",+ ggufInference: "GGUF मॉडल मेमोरी",unavailable: "उपलब्ध नहीं",detecting: "GPU खोजे जा रहे हैं...",unreadable: "इस सर्वर का हार्डवेयर नहीं पढ़ा जा सका।",diff --git a/studio/frontend/src/i18n/locales/it.ts b/studio/frontend/src/i18n/locales/it.tsindex d0f4a0b024c..7e3b44ca0da 100644--- a/studio/frontend/src/i18n/locales/it.ts+++ b/studio/frontend/src/i18n/locales/it.ts@@ -1251,7 +1251,11 @@ export const it = {},gpu: {title: "Dispositivi GPU",- ggufInference: "Inferenza GGUF",+ memory: "Memoria GPU",+ sharedWithSystemRam: "Condivisa con la RAM di sistema",+ estimatedAvailable: "Disponibilità stimata: {value}",+ sharedEstimatedAvailable: "RAM di sistema condivisa: disponibilità stimata di {value}",+ ggufInference: "Memoria per i modelli GGUF",unavailable: "non disponibile",detecting: "Ricerca di GPU...",unreadable: "Impossibile leggere l'hardware di questo server.",diff --git a/studio/frontend/src/i18n/locales/ja.ts b/studio/frontend/src/i18n/locales/ja.tsindex 8d9594fbf05..27d94bc7f00 100644--- a/studio/frontend/src/i18n/locales/ja.ts+++ b/studio/frontend/src/i18n/locales/ja.ts@@ -1239,7 +1239,11 @@ export const ja = {},gpu: {title: "GPU デバイス",- ggufInference: "GGUF 推論",+ memory: "GPUメモリ",+ sharedWithSystemRam: "システムRAMと共有",+ estimatedAvailable: "推定空き容量: {value}",+ sharedEstimatedAvailable: "共有システムRAM: 推定空き容量 {value}",+ ggufInference: "GGUFモデル用メモリ",unavailable: "利用不可",detecting: "GPU を確認しています...",unreadable: "このサーバーのハードウェアを読み取れませんでした。",diff --git a/studio/frontend/src/i18n/locales/ko.ts b/studio/frontend/src/i18n/locales/ko.tsindex 143da8dd525..4bd48d0f9a8 100644--- a/studio/frontend/src/i18n/locales/ko.ts+++ b/studio/frontend/src/i18n/locales/ko.ts@@ -1255,7 +1255,11 @@ export const ko = {},gpu: {title: "GPU 장치",- ggufInference: "GGUF 추론",+ memory: "GPU 메모리",+ sharedWithSystemRam: "시스템 RAM과 공유",+ estimatedAvailable: "예상 사용 가능: {value}",+ sharedEstimatedAvailable: "공유 시스템 RAM: 예상 사용 가능 {value}",+ ggufInference: "GGUF 모델 메모리",unavailable: "사용할 수 없음",detecting: "GPU를 확인하는 중...",unreadable: "이 서버의 하드웨어를 읽을 수 없습니다.",diff --git a/studio/frontend/src/i18n/locales/pt-br.ts b/studio/frontend/src/i18n/locales/pt-br.tsindex 6a189732735..ed9df4d96cc 100644--- a/studio/frontend/src/i18n/locales/pt-br.ts+++ b/studio/frontend/src/i18n/locales/pt-br.ts@@ -1269,7 +1269,11 @@ export const ptBR = {},gpu: {title: "Dispositivos de GPU",- ggufInference: "Inferência com GGUF",+ memory: "Memória da GPU",+ sharedWithSystemRam: "Compartilhada com a RAM do sistema",+ estimatedAvailable: "Disponibilidade estimada: {value}",+ sharedEstimatedAvailable: "RAM compartilhada do sistema: disponibilidade estimada de {value}",+ ggufInference: "Memória para modelos GGUF",unavailable: "indisponível",detecting: "Procurando GPUs...",unreadable: "Não foi possível ler o hardware deste servidor.",diff --git a/studio/frontend/src/i18n/locales/ru.ts b/studio/frontend/src/i18n/locales/ru.tsindex 0cee8991bae..a737730399a 100644--- a/studio/frontend/src/i18n/locales/ru.ts+++ b/studio/frontend/src/i18n/locales/ru.ts@@ -1264,7 +1264,11 @@ export const ru = {},gpu: {title: "Устройства GPU",- ggufInference: "Инференс GGUF",+ memory: "Память GPU",+ sharedWithSystemRam: "Общая с оперативной памятью системы",+ estimatedAvailable: "Примерно доступно: {value}",+ sharedEstimatedAvailable: "Общая оперативная память системы: примерно {value} доступно",+ ggufInference: "Память для моделей GGUF",unavailable: "недоступно",detecting: "Поиск GPU...",unreadable: "Не удалось прочитать оборудование этого сервера.",diff --git a/studio/frontend/src/i18n/locales/zh-CN.ts b/studio/frontend/src/i18n/locales/zh-CN.tsindex 2e169259b80..04c281afb40 100644--- a/studio/frontend/src/i18n/locales/zh-CN.ts+++ b/studio/frontend/src/i18n/locales/zh-CN.ts@@ -1233,7 +1233,11 @@ export const zhCN = {},gpu: {title: "GPU 设备",- ggufInference: "GGUF 推理",+ memory: "GPU 内存",+ sharedWithSystemRam: "与系统 RAM 共享",+ estimatedAvailable: "预计可用:{value}",+ sharedEstimatedAvailable: "共享系统 RAM:预计可用 {value}",+ ggufInference: "GGUF 模型内存",unavailable: "不可用",detecting: "正在检查 GPU...",unreadable: "无法读取此服务器的硬件信息。",diff --git a/studio/frontend/tests/gpu-memory-display.test.ts b/studio/frontend/tests/gpu-memory-display.test.tsnew file mode 100644index 00000000000..1b8871a2570--- /dev/null+++ b/studio/frontend/tests/gpu-memory-display.test.ts@@ -0,0 +1,107 @@+// 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 { gpuMemoryDisplay } from "../src/hooks/gpu-memory-display.ts";+import {+ gpuMemoryTotalsGb,+ resolveGpuVramUsedGb,+} from "../src/hooks/gpu-vram.ts";+import type { GpuDevice, SystemGpuInfo } from "../src/hooks/use-system.ts";++const integrated: GpuDevice = {+ index_kind: "vulkan",+ shared_memory: true,+ memory_total_gb: 25.69,+ vram_free_gb: 25.69,+};+const discrete: GpuDevice = {+ index_kind: "vulkan",+ shared_memory: false,+ memory_total_gb: 16,+ vram_used_gb: 1,+ vram_free_gb: 15,+};+const gpu = (devices: GpuDevice[], aggregate?: number): SystemGpuInfo => ({+ available: true,+ devices,+ vram_used_gb_aggregate: aggregate,+});++test("Vulkan iGPU presents allocation headroom without manufacturing usage", () => {+ const display = gpuMemoryDisplay(gpu([integrated]));+ assert.equal(display.sharedOnly, true);+ assert.equal(display.sharedAvailableGb, 25.69);+ assert.deepEqual(display.usageDevices, []);+ assert.equal(resolveGpuVramUsedGb(display.usageGpu), null);+});++test("mixed inventory measures dedicated usage against dedicated capacity only", () => {+ const input = gpu([discrete, integrated], 8);+ const display = gpuMemoryDisplay(input);+ assert.equal(display.sharedOnly, false);+ assert.equal(display.sharedAvailableGb, 25.69);+ const total = gpuMemoryTotalsGb(display.usageDevices).total;+ const used = resolveGpuVramUsedGb(display.usageGpu);+ assert.equal(total, 16);+ assert.equal(used, 1);+ assert.equal((used! / total) * 100, 6.25);+ assert.equal(input.devices.length, 2);+ assert.equal(gpuMemoryTotalsGb(input.devices).total, 41.69);+});++test("shared views count once and zero is a known reading", () => {+ assert.equal(+ gpuMemoryDisplay(gpu([integrated, { ...integrated, vram_free_gb: 12 }]))+ .sharedAvailableGb,+ 25.69,+ );+ assert.equal(+ gpuMemoryDisplay(gpu([{ ...integrated, vram_free_gb: 0 }]))+ .sharedAvailableGb,+ 0,+ );+});++test("missing or invalid shared free readings never fall back to capacity", () => {+ for (const free of [undefined, null, NaN, Infinity, -1]) {+ // null is also possible on the wire despite the optional-number API type.+ const device = { ...integrated, vram_free_gb: free } as GpuDevice;+ assert.equal(gpuMemoryDisplay(gpu([device])).sharedAvailableGb, null);+ assert.equal(+ gpuMemoryDisplay(gpu([integrated, device])).sharedAvailableGb,+ null,+ );+ }+});++test("ROCm host aggregate survives and unattributable rows remain unknown", () => {+ const devices = [+ { index_kind: "torch", memory_total_gb: 16 },+ { index_kind: "torch", memory_total_gb: 24 },+ ];+ const display = gpuMemoryDisplay(gpu(devices, 3));+ assert.equal(display.sharedOnly, false);+ assert.equal(resolveGpuVramUsedGb(display.usageGpu), 3);+ assert.equal(resolveGpuVramUsedGb(gpu(devices)), null);+ assert.equal(display.sharedDevices.length, 0);+});++test("host aggregate cannot supply usage for a filtered mixed inventory", () => {+ const display = gpuMemoryDisplay(+ gpu([{ ...discrete, vram_used_gb: undefined }, integrated], 3),+ );+ assert.equal(resolveGpuVramUsedGb(display.usageGpu), null);+});++test("other backends retain their shared-pool usage reporting", () => {+ for (const index_kind of ["torch", "metal", undefined]) {+ const device = { ...integrated, index_kind, vram_used_gb: 2 };+ const display = gpuMemoryDisplay(gpu([device]));+ assert.equal(display.sharedDevices.length, 0);+ assert.equal(gpuMemoryTotalsGb(display.usageDevices).total, 25.69);+ assert.equal(resolveGpuVramUsedGb(display.usageGpu), 2);+ }+ assert.deepEqual(gpuMemoryDisplay(undefined).usageDevices, []);+});diff --git a/studio/frontend/tests/resources-shared-memory-display.test.ts b/studio/frontend/tests/resources-shared-memory-display.test.tsindex ef78573900e..ca090774952 100644--- a/studio/frontend/tests/resources-shared-memory-display.test.ts+++ b/studio/frontend/tests/resources-shared-memory-display.test.ts@@ -9,7 +9,7 @@ import { readSrc } from "./helpers/kit.ts";const resourcesTab = readSrc("features/settings/tabs/resources-tab.tsx");test("Resources separates dedicated VRAM from shared GPU memory", () => {- assert.match(resourcesTab, /gpuMemoryTotalsGb\(devices\)/);+ assert.match(resourcesTab, /gpuMemoryTotalsGb\(usageDevices\)/);assert.match(resourcesTab, /metrics\.vramShared > 0/);assert.match(resourcesTab, /environment\.vramWithShared/);assert.match(resourcesTab, /vram: formatGiB\(metrics\.vramDedicated\)/);