Deployments: llama.cpp web UI toggle, clearer start failures, log fixes
- Web UI option for llama.cpp deployments (--no-webui when off); the deployment page links to it on the published host port. - Follow container logs after the start with tail=all: following a created container returned an already-closed stream, so startup output was lost. - Failed starts name the cause from the log (vLLM ValueError, llama.cpp error lines) before the last output. - A deployment's vLLM dtype replaces the runtime's --dtype instead of repeating it. - vLLM memory estimate: 3 GiB overhead (measured ~6.9 GiB for SmolLM2-135M with a 4 GiB KV cache). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8b74fa69db
commit
66e6a8c4f7
11 files changed
+130
-23
No files matched your search
@@ -24,6 +24,16 @@ const inModels = (localPath: string, file?: string | null) =>
|
||||
const num = (flag: string, v: number | null | undefined) => (v != null && Number.isFinite(v) ? [flag, String(v)] : []);
|
||||
const str = (flag: string, v: string | null | undefined) => (v ? [flag, v] : []);
|
||||
|
||||
/** `args` without `flag` ("--flag value" or "--flag=value"). */
|
||||
function withoutFlag(args: string[], flag: string): string[] {
|
||||
const out: string[] = [];
|
||||
for (let i = 0; i < args.length; i++) {
|
||||
if (args[i] === flag) i++;
|
||||
else if (!args[i].startsWith(`${flag}=`)) out.push(args[i]);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
export function buildCommand({ engine, options: o, model, runtime }: CommandInput): ContainerCommand {
|
||||
const port = ENGINE_PORT[engine];
|
||||
if (engine === "llama.cpp") {
|
||||
@@ -48,6 +58,7 @@ export function buildCommand({ engine, options: o, model, runtime }: CommandInpu
|
||||
...str("-fa", o.flashAttn),
|
||||
...(o.mmproj ? ["--mmproj", inModels(model.localPath, o.mmproj)] : []),
|
||||
...(o.draftFile ? ["-md", inModels(model.localPath, o.draftFile), "--spec-type", o.draftType ?? "draft-simple"] : []),
|
||||
...(o.webui === false ? ["--no-webui"] : []),
|
||||
"--metrics",
|
||||
...runtime.extraArgs,
|
||||
...o.extraArgs,
|
||||
@@ -68,8 +79,8 @@ export function buildCommand({ engine, options: o, model, runtime }: CommandInpu
|
||||
model.repoId,
|
||||
...num("--max-model-len", o.contextSize),
|
||||
...num("--max-num-seqs", o.maxNumSeqs),
|
||||
...runtime.extraArgs,
|
||||
// After the runtime's defaults, so a deployment's dtype wins (argparse keeps the last value).
|
||||
// A deployment's dtype replaces the runtime's default instead of repeating the flag.
|
||||
...(o.dtype ? withoutFlag(runtime.extraArgs, "--dtype") : runtime.extraArgs),
|
||||
...str("--dtype", o.dtype),
|
||||
...o.extraArgs,
|
||||
];
|
||||
@@ -86,7 +97,8 @@ export function renderCommand(image: string, cmd: ContainerCommand): string {
|
||||
/** Rough memory need: model files plus KV cache and runtime overhead. */
|
||||
export function estimateMemoryMb(fileBytes: number, contextSize: number, engine: RuntimeEngine, kvCacheGb?: number | null): number {
|
||||
const model = fileBytes / 2 ** 20;
|
||||
if (engine === "vllm") return Math.ceil(model + (kvCacheGb ?? 4) * 1024 + 2048);
|
||||
// vLLM CPU: API server, engine core and worker each load torch (~3 GiB measured with v0.31.0).
|
||||
if (engine === "vllm") return Math.ceil(model + (kvCacheGb ?? 4) * 1024 + 3072);
|
||||
// llama.cpp: ~ctx/8 MiB of f16 KV cache per 4k tokens for small models is too model-specific to
|
||||
// compute without the GGUF header; a margin that scales with context is a safe default.
|
||||
return Math.ceil(model * 1.1 + 512 + contextSize / 16);
|
||||
|
||||
Reference in new issue
Block a user