Merge pull request 'fix: Perf tab field mapping + TTS service (openedai-speech) + v0.7.0' (#17) from fix/perf-and-tts into master

Reviewed-on: https://gitea.mikan/mikan/GPU-Node/pulls/17
This commit was merged in pull request #17.
This commit is contained in:
2026-10-29 20:59:33 +00:00
9 changed files with 242 additions and 125 deletions

View File

@@ -163,6 +163,25 @@ services:
- "node.role=comfyui" - "node.role=comfyui"
- "node.instance=${TAILSCALE_HOSTNAME:-gpu-node}" - "node.instance=${TAILSCALE_HOSTNAME:-gpu-node}"
tts:
profiles:
- tts
image: ghcr.io/matatonic/openedai-speech:latest
container_name: ${TAILSCALE_HOSTNAME:-gpu-node}-tts
gpus: all
volumes:
- ${HOST_PROJECT_PATH:-./}/gpu/tts/voices:/app/voices
- ${HOST_PROJECT_PATH:-./}/gpu/tts/cache:/app/cache
environment:
PORT: 8000
HALF_PRECISION: "false"
networks:
- gpu-node
restart: "no"
labels:
- "node.role=tts"
- "node.instance=${TAILSCALE_HOSTNAME:-gpu-node}"
dashboard: dashboard:
image: gpu-node-dashboard image: gpu-node-dashboard
container_name: ${TAILSCALE_HOSTNAME:-gpu-node}-dashboard container_name: ${TAILSCALE_HOSTNAME:-gpu-node}-dashboard

View File

@@ -120,7 +120,7 @@ export async function GET() {
ok: envError === null, ok: envError === null,
error: envError, error: envError,
}, },
version: "0.6.0", version: "0.7.0",
timestamp: new Date().toISOString(), timestamp: new Date().toISOString(),
}); });
} }

View File

@@ -21,6 +21,7 @@ const VALID_ROLES: ServiceRole[] = [
"ssh-companion", "ssh-companion",
"gpu-test", "gpu-test",
"dashboard", "dashboard",
"tts",
]; ];
function parseRole(role: string): ServiceRole | null { function parseRole(role: string): ServiceRole | null {

View File

@@ -3825,9 +3825,25 @@ interface SlotInfo {
id: number; id: number;
is_processing: boolean; is_processing: boolean;
n_ctx: number; n_ctx: number;
n_past: number; // Newer llama.cpp field names
n_eval: number; n_prompt_tokens?: number;
prompt: number[]; n_prompt_tokens_processed?: number;
n_prompt_tokens_cache?: number;
speculative?: boolean;
// Legacy field names (older versions)
n_past?: number;
n_eval?: number;
prompt?: number[];
// Next token info (newer versions)
next_token?: Array<{
has_next_token?: boolean;
has_new_line?: boolean;
n_remain?: number;
n_decoded?: number;
}>;
// Per-slot params (newer versions include these)
params?: Record<string, unknown>;
// Timings — only present after generation in some versions
timings?: { timings?: {
prompt_n: number; prompt_n: number;
prompt_ms: number; prompt_ms: number;
@@ -3839,7 +3855,6 @@ interface SlotInfo {
predicted_per_second: number; predicted_per_second: number;
cache_hit_rate?: number; cache_hit_rate?: number;
}; };
// Speculative decoding stats (if --spec-* was passed at startup)
spec?: { spec?: {
accepted: number; accepted: number;
drafted: number; drafted: number;
@@ -3996,11 +4011,16 @@ function OverviewView({
</p> </p>
); );
} }
// Try multiple key names — llama.cpp has changed these across versions
const gen = (props.default_generation_settings || // Extract params from nested structure
props.generation_settings) as // Newer llama.cpp: default_generation_settings.params.temperature
// Older: default_generation_settings.temperature
const dgs = (props.default_generation_settings ||
props.generation_settings) as Record<string, unknown> | undefined;
const gen = (dgs?.params || dgs) as
| { | {
n_predict?: number; n_predict?: number;
max_tokens?: number;
temperature?: number; temperature?: number;
top_k?: number; top_k?: number;
top_p?: number; top_p?: number;
@@ -4008,45 +4028,75 @@ function OverviewView({
repeat_penalty?: number; repeat_penalty?: number;
} }
| undefined; | undefined;
// Cumulative timings across all slots (sum of per-slot)
// Cumulative timings across all slots
const totalPredictedN = slots.reduce( const totalPredictedN = slots.reduce(
(s, x) => s + (x.timings?.predicted_n || 0), (s, x) =>
s +
(x.timings?.predicted_n || x.next_token?.[0]?.n_decoded || 0),
0 0
); );
const totalPromptN = slots.reduce( const totalPromptN = slots.reduce(
(s, x) => s + (x.timings?.prompt_n || 0), (s, x) =>
s +
(x.timings?.prompt_n ||
x.n_prompt_tokens_processed ||
x.n_past ||
0),
0 0
); );
// Average TPS across active slots // Average TPS — from timings (if available)
const activeSlots = slots.filter((s) => s.timings?.predicted_per_second); const activeSlots = slots.filter((s) => s.timings?.predicted_per_second);
const avgTps = const avgTps =
activeSlots.length > 0 activeSlots.length > 0
? activeSlots.reduce((s, x) => s + (x.timings?.predicted_per_second || 0), 0) / ? activeSlots.reduce(
activeSlots.length (s, x) => s + (x.timings?.predicted_per_second || 0),
0
) / activeSlots.length
: null; : null;
// Multimodal — newer: modalities.vision, older: has_multimodal
const modalities = props.modalities as
| { vision?: boolean; audio?: boolean; video?: boolean }
| undefined;
const hasMultimodal = Boolean( const hasMultimodal = Boolean(
props.has_multimodal ?? props.mmproj_path ?? props.is_multimodal modalities?.vision ||
modalities?.audio ||
props.has_multimodal ||
props.is_multimodal
); );
const totalSlots = const totalSlots =
(props.total_slots as number) || (props.total_slots as number) ||
(props.n_slots as number) || (props.n_slots as number) ||
slots.length; slots.length;
// Ctx usage — guard against NaN (slots may not have n_past/n_ctx when idle)
// Ctx usage — try newer field names first
const ctxUsed = slots.reduce( const ctxUsed = slots.reduce(
(s, x) => s + (typeof x.n_past === "number" ? x.n_past : 0), (s, x) =>
s +
(x.n_prompt_tokens_processed ?? x.n_past ?? 0),
0 0
); );
const ctxTotal = slots.reduce( const ctxTotal = slots.reduce(
(s, x) => s + (typeof x.n_ctx === "number" ? x.n_ctx : 0), (s, x) => s + (x.n_ctx ?? 0),
0 0
); );
// n_context from props (might be n_context or n_ctx_total) // Total ctx from props: newer: default_generation_settings.n_ctx
const totalCtx = const totalCtx =
(dgs?.n_ctx as number) ||
(props.n_context as number) || (props.n_context as number) ||
(props.n_ctx_total as number) || (props.n_ctx_total as number) ||
ctxTotal || ctxTotal ||
null; null;
// Speculative decoding
const specSlots = slots.filter((s) => s.speculative);
const hasSpec = specSlots.length > 0;
// Build info
const buildInfo = props.build_info as string | undefined;
const [showRaw, setShowRaw] = React.useState(false); const [showRaw, setShowRaw] = React.useState(false);
return ( return (
@@ -4061,7 +4111,7 @@ function OverviewView({
<MetricCell <MetricCell
label="Total slots" label="Total slots"
value={`${totalSlots}`} value={`${totalSlots}`}
hint={`${activeSlots.length} active`} hint={`${activeSlots.length} with timings`}
/> />
<MetricCell <MetricCell
label="Ctx usage" label="Ctx usage"
@@ -4072,21 +4122,21 @@ function OverviewView({
? `${ctxUsed}` ? `${ctxUsed}`
: "—" : "—"
} }
hint="tokens across all slots" hint="prompt tokens processed / ctx"
/> />
<MetricCell <MetricCell
label="Multimodal" label="Multimodal"
value={hasMultimodal ? "yes" : "no"} value={hasMultimodal ? "yes" : "no"}
hint={hasMultimodal ? "mmproj loaded" : "text-only"} hint={hasMultimodal ? "vision/audio loaded" : "text-only"}
/> />
</div> </div>
{/* Cumulative stats */} {/* Cumulative stats */}
<div className="grid grid-cols-2 sm:grid-cols-4 gap-3 text-xs"> <div className="grid grid-cols-2 sm:grid-cols-4 gap-3 text-xs">
<MetricCell <MetricCell
label="Predicted" label="Generated"
value={totalPredictedN > 0 ? `${totalPredictedN}` : "—"} value={totalPredictedN > 0 ? `${totalPredictedN}` : "—"}
hint="tokens generated" hint="tokens decoded"
/> />
<MetricCell <MetricCell
label="Prompt" label="Prompt"
@@ -4103,9 +4153,9 @@ function OverviewView({
hint={typeof props.model_path === "string" ? props.model_path : ""} hint={typeof props.model_path === "string" ? props.model_path : ""}
/> />
<MetricCell <MetricCell
label="Total ctx" label="Speculative"
value={totalCtx != null ? `${totalCtx}` : "—"} value={hasSpec ? "yes" : "no"}
hint="n_ctx × parallel" hint={hasSpec ? `${specSlots.length} slots` : "disabled"}
/> />
</div> </div>
@@ -4113,7 +4163,7 @@ function OverviewView({
{slots.length > 0 && ( {slots.length > 0 && (
<div> <div>
<div className="text-xs text-muted-foreground mb-2 font-medium uppercase tracking-wide"> <div className="text-xs text-muted-foreground mb-2 font-medium uppercase tracking-wide">
Slots Slots ({totalCtx != null ? `${totalCtx} ctx` : ""}{buildInfo ? ` · ${buildInfo}` : ""})
</div> </div>
<SlotsView slots={slots} /> <SlotsView slots={slots} />
</div> </div>
@@ -4127,22 +4177,22 @@ function OverviewView({
</div> </div>
<div className="grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 gap-2 text-xs font-mono"> <div className="grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 gap-2 text-xs font-mono">
<span> <span>
<span className="text-muted-foreground">temp:</span> {gen.temperature ?? "?"} <span className="text-muted-foreground">temp:</span> {gen.temperature?.toFixed(2) ?? "?"}
</span> </span>
<span> <span>
<span className="text-muted-foreground">top_k:</span> {gen.top_k ?? "?"} <span className="text-muted-foreground">top_k:</span> {gen.top_k ?? "?"}
</span> </span>
<span> <span>
<span className="text-muted-foreground">top_p:</span> {gen.top_p ?? "?"} <span className="text-muted-foreground">top_p:</span> {gen.top_p?.toFixed(2) ?? "?"}
</span> </span>
<span> <span>
<span className="text-muted-foreground">min_p:</span> {gen.min_p ?? "?"} <span className="text-muted-foreground">min_p:</span> {gen.min_p?.toFixed(2) ?? "?"}
</span> </span>
<span> <span>
<span className="text-muted-foreground">rep:</span> {gen.repeat_penalty ?? "?"} <span className="text-muted-foreground">rep:</span> {gen.repeat_penalty?.toFixed(2) ?? "?"}
</span> </span>
<span> <span>
<span className="text-muted-foreground">n_pred:</span> {gen.n_predict ?? "?"} <span className="text-muted-foreground">n_pred:</span> {gen.n_predict ?? gen.max_tokens ?? "?"}
</span> </span>
</div> </div>
</div> </div>
@@ -4187,95 +4237,135 @@ function SlotsView({ slots }: { slots: SlotInfo[] }) {
} }
return ( return (
<div className="space-y-3"> <div className="space-y-3">
{slots.map((s) => ( {slots.map((s) => {
<div key={s.id} className="rounded-md border p-3 bg-card space-y-3"> // Use n_prompt_tokens_processed (newer) or n_past (legacy)
<div className="flex items-center justify-between gap-2"> const promptTokens =
<div className="flex items-center gap-2"> s.n_prompt_tokens_processed ?? s.n_past ?? null;
<Badge variant={s.is_processing ? "default" : "secondary"}> const totalPromptTokens =
{s.is_processing ? "processing" : "idle"} s.n_prompt_tokens ?? null;
</Badge> const cacheTokens = s.n_prompt_tokens_cache ?? null;
<span className="text-xs text-muted-foreground font-mono"> const decodedTokens = s.next_token?.[0]?.n_decoded ?? null;
slot #{s.id} const remainTokens = s.next_token?.[0]?.n_remain ?? null;
</span> const hasTimings = !!s.timings;
</div>
<div className="text-xs text-muted-foreground font-mono"> return (
ctx: {s.n_past ?? "?"}/{s.n_ctx ?? "?"} <div key={s.id} className="rounded-md border p-3 bg-card space-y-3">
<div className="flex items-center justify-between gap-2 flex-wrap">
<div className="flex items-center gap-2">
<Badge variant={s.is_processing ? "default" : "secondary"}>
{s.is_processing ? "processing" : "idle"}
</Badge>
<span className="text-xs text-muted-foreground font-mono">
slot #{s.id}
</span>
{s.speculative && (
<Badge variant="outline" className="text-[10px]">
spec
</Badge>
)}
</div>
<div className="text-xs text-muted-foreground font-mono">
ctx: {promptTokens ?? "?"}/{s.n_ctx ?? "?"}
{totalPromptTokens != null && ` (${totalPromptTokens} prompt)`}
{cacheTokens != null && ` · ${cacheTokens} cached`}
</div>
</div> </div>
{hasTimings ? (
<div className="grid grid-cols-2 sm:grid-cols-4 gap-3 text-xs">
<MetricCell
label="TPS"
value={
s.timings!.predicted_per_second != null
? `${s.timings!.predicted_per_second.toFixed(1)} tok/s`
: "—"
}
hint={
s.timings!.predicted_n != null
? `${s.timings!.predicted_n} tok / ${(s.timings!.predicted_ms! / 1000).toFixed(2)}s`
: undefined
}
/>
<MetricCell
label="TTFT"
value={
s.timings!.prompt_ms != null
? `${(s.timings!.prompt_ms / 1000).toFixed(2)}s`
: "—"
}
hint={
s.timings!.prompt_n != null
? `${s.timings!.prompt_n} prompt tok`
: undefined
}
/>
<MetricCell
label="Prompt TPS"
value={
s.timings!.prompt_per_second != null
? `${s.timings!.prompt_per_second.toFixed(1)} tok/s`
: "—"
}
/>
<MetricCell
label="Cache hit"
value={
s.timings!.cache_hit_rate != null
? `${(s.timings!.cache_hit_rate * 100).toFixed(1)}%`
: "—"
}
/>
</div>
) : (
<div className="space-y-1">
<p className="text-xs text-muted-foreground italic">
No per-token timings (idle or no generation yet).
</p>
{decodedTokens != null && (
<div className="grid grid-cols-2 sm:grid-cols-3 gap-3 text-xs">
<MetricCell
label="Decoded"
value={`${decodedTokens}`}
hint="tokens generated"
/>
<MetricCell
label="Remaining"
value={remainTokens != null ? `${remainTokens}` : "—"}
hint="tokens left"
/>
<MetricCell
label="Cache"
value={cacheTokens != null ? `${cacheTokens}` : "—"}
hint="cached prompt tokens"
/>
</div>
)}
</div>
)}
{s.spec && (
<div className="grid grid-cols-2 sm:grid-cols-3 gap-3 text-xs pt-2 border-t">
<MetricCell
label="Spec drafted"
value={`${s.spec.drafted}`}
/>
<MetricCell
label="Spec accepted"
value={`${s.spec.accepted}`}
/>
<MetricCell
label="Accept rate"
value={
s.spec.drafted > 0
? `${((s.spec.accepted / s.spec.drafted) * 100).toFixed(0)}%`
: "—"
}
/>
</div>
)}
</div> </div>
);
{s.timings ? ( })}
<div className="grid grid-cols-2 sm:grid-cols-4 gap-3 text-xs">
<MetricCell
label="TPS"
value={
s.timings.predicted_per_second != null
? `${s.timings.predicted_per_second.toFixed(1)} tok/s`
: "—"
}
hint={
s.timings.predicted_n != null
? `${s.timings.predicted_n} tok / ${(s.timings.predicted_ms / 1000).toFixed(2)}s`
: undefined
}
/>
<MetricCell
label="TTFT"
value={
s.timings.prompt_ms != null
? `${(s.timings.prompt_ms / 1000).toFixed(2)}s`
: "—"
}
hint={
s.timings.prompt_n != null
? `${s.timings.prompt_n} prompt tok`
: undefined
}
/>
<MetricCell
label="Prompt TPS"
value={
s.timings.prompt_per_second != null
? `${s.timings.prompt_per_second.toFixed(1)} tok/s`
: "—"
}
/>
<MetricCell
label="Cache hit"
value={
s.timings.cache_hit_rate != null
? `${(s.timings.cache_hit_rate * 100).toFixed(1)}%`
: "—"
}
/>
</div>
) : (
<p className="text-xs text-muted-foreground italic">
No timings yet — slot hasn&apos;t processed any tokens.
</p>
)}
{s.spec && (
<div className="grid grid-cols-2 sm:grid-cols-3 gap-3 text-xs pt-2 border-t">
<MetricCell
label="Spec drafted"
value={`${s.spec.drafted}`}
/>
<MetricCell
label="Spec accepted"
value={`${s.spec.accepted}`}
/>
<MetricCell
label="Accept rate"
value={
s.spec.drafted > 0
? `${((s.spec.accepted / s.spec.drafted) * 100).toFixed(0)}%`
: "—"
}
/>
</div>
)}
</div>
))}
</div> </div>
); );
} }

View File

@@ -1207,6 +1207,7 @@ export type ServiceRole =
| "ssh-companion" | "ssh-companion"
| "gpu-test" | "gpu-test"
| "dashboard" | "dashboard"
| "tts"
| "tailscale"; | "tailscale";
const COMPOSE_PROFILES: Partial<Record<ServiceRole, string>> = { const COMPOSE_PROFILES: Partial<Record<ServiceRole, string>> = {
@@ -1219,6 +1220,7 @@ const COMPOSE_PROFILES: Partial<Record<ServiceRole, string>> = {
"ssh-companion": "wake", "ssh-companion": "wake",
"model-worker": "wake", "model-worker": "wake",
webdav: "wake", webdav: "wake",
tts: "tts",
}; };
export async function startService( export async function startService(

View File

@@ -4,7 +4,7 @@
* Displayed in the footer and available via /api/debug so the user can * Displayed in the footer and available via /api/debug so the user can
* verify the update actually took effect. * verify the update actually took effect.
*/ */
export const DASHBOARD_VERSION = "0.6.0"; export const DASHBOARD_VERSION = "0.7.0";
/** /**
* Build timestamp — set at build time by Next.js. * Build timestamp — set at build time by Next.js.

View File

@@ -34,7 +34,7 @@ Usage:
gpuctl restart <service> gpuctl restart <service>
gpuctl logs <service> gpuctl logs <service>
Services: llama, comfy, model-worker, webdav, dashboard, Services: llama, comfy, model-worker, webdav, dashboard, tts,
ssh-main, ssh-companion, gpu-test ssh-main, ssh-companion, gpu-test
EOF EOF
} }

View File

@@ -115,7 +115,7 @@ sleep_mode() {
echo "Entering sleep mode for instance: $NODE_INSTANCE" echo "Entering sleep mode for instance: $NODE_INSTANCE"
echo "Keeping: tailscale + $KEEP_SSH_ROLE" echo "Keeping: tailscale + $KEEP_SSH_ROLE"
for ROLE in llama comfyui gpu-test model-worker webdav dashboard; do for ROLE in llama comfyui gpu-test model-worker webdav dashboard tts; do
CTR=$(get_service_container "$ROLE" 2>/dev/null) || true CTR=$(get_service_container "$ROLE" 2>/dev/null) || true
[ -n "$CTR" ] && docker rm -f "$CTR" 2>/dev/null || true [ -n "$CTR" ] && docker rm -f "$CTR" 2>/dev/null || true
done done
@@ -151,17 +151,19 @@ wake_mode() {
echo "Entering wake mode for instance: $NODE_INSTANCE" echo "Entering wake mode for instance: $NODE_INSTANCE"
echo "Current SSH role: $SSH_ROLE" echo "Current SSH role: $SSH_ROLE"
echo "Host project: $HOST_PROJECT_PATH" echo "Host project: $HOST_PROJECT_PATH"
echo "Starting: $TARGET_SSH_SERVICE + model-worker + webdav + dashboard" echo "Starting: $TARGET_SSH_SERVICE + model-worker + webdav + dashboard + tts"
HOST_PROJECT_PATH="$HOST_PROJECT_PATH" \ HOST_PROJECT_PATH="$HOST_PROJECT_PATH" \
docker compose \ docker compose \
-f "$COMPOSE_FILE" \ -f "$COMPOSE_FILE" \
--profile wake \ --profile wake \
--profile tts \
up -d \ up -d \
"$TARGET_SSH_SERVICE" \ "$TARGET_SSH_SERVICE" \
model-worker \ model-worker \
webdav \ webdav \
dashboard dashboard \
tts
# Belt-and-suspenders: ensure dashboard is up even if the --profile wake # Belt-and-suspenders: ensure dashboard is up even if the --profile wake
# flag above didn't include it (compose v2 with --profile + explicit names # flag above didn't include it (compose v2 with --profile + explicit names

View File

@@ -17,6 +17,9 @@
}, },
"8090": { "8090": {
"TCPForward": "dashboard:3000" "TCPForward": "dashboard:3000"
},
"8100": {
"TCPForward": "tts:8000"
} }
} }
} }