Deployments: serve a model with a runtime container
- deployments + deployment_logs tables; desired/actual state reconciled by the worker (create/start/stop/remove via the socket proxy, /health wait, log follower, stats, memory guard, adopt/remove containers on restart). - Pure command builder for llama-server and vllm serve (mmproj, MTP draft, KV cache types, dtype, KV cache size) with tests; file candidates per engine with tests. - New main menu entry Deployments: list, new/edit form (runtime -> model and files -> launch options, live command preview), detail page with stats, log, endpoint and a streaming chat smoke test. Not yet tested end-to-end against real containers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4f7ae1fc8c
commit
8b74fa69db
32 files changed
+3824
-3
No files matched your search
@@ -0,0 +1,49 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { describe, it } from "node:test";
|
||||
import { buildCommand, renderCommand } from "./deploy-command";
|
||||
|
||||
const model = { repoId: "unsloth/Qwen3-0.6B-GGUF", localPath: "unsloth/Qwen3-0.6B-GGUF" };
|
||||
|
||||
describe("buildCommand", () => {
|
||||
it("builds llama-server arguments with mmproj and MTP draft", () => {
|
||||
const cmd = buildCommand({
|
||||
engine: "llama.cpp",
|
||||
model,
|
||||
runtime: { env: {}, extraArgs: ["--jinja"] },
|
||||
options: {
|
||||
modelFile: "Qwen3-0.6B-Q4_K_M.gguf",
|
||||
mmproj: "mmproj-F16.gguf",
|
||||
draftFile: "MTP/mtp-Q4_0.gguf",
|
||||
draftType: "draft-mtp",
|
||||
contextSize: 4096,
|
||||
threads: 8,
|
||||
parallel: 1,
|
||||
cacheTypeK: "q8_0",
|
||||
extraArgs: ["--temp", "0.7"],
|
||||
},
|
||||
});
|
||||
assert.equal(cmd.port, 8080);
|
||||
assert.deepEqual(cmd.args.slice(0, 2), ["-m", "/models/unsloth/Qwen3-0.6B-GGUF/Qwen3-0.6B-Q4_K_M.gguf"]);
|
||||
const s = cmd.args.join(" ");
|
||||
assert.match(s, /-c 4096 -t 8 -tb 8 -np 1 -ctk q8_0/);
|
||||
assert.match(s, /--mmproj \/models\/unsloth\/Qwen3-0\.6B-GGUF\/mmproj-F16\.gguf/);
|
||||
assert.match(s, /-md \/models\/unsloth\/Qwen3-0\.6B-GGUF\/MTP\/mtp-Q4_0\.gguf --spec-type draft-mtp/);
|
||||
assert.ok(s.endsWith("--metrics --jinja --temp 0.7"));
|
||||
assert.ok(!s.includes("-b "), "unset options are left out");
|
||||
});
|
||||
|
||||
it("builds vllm serve arguments; deployment dtype and KV cache override the runtime", () => {
|
||||
const cmd = buildCommand({
|
||||
engine: "vllm",
|
||||
model: { repoId: "HuggingFaceTB/SmolLM2-135M-Instruct", localPath: "HuggingFaceTB/SmolLM2-135M-Instruct" },
|
||||
runtime: { env: { VLLM_CPU_KVCACHE_SPACE: "4" }, extraArgs: ["--dtype=bfloat16"] },
|
||||
options: { modelFile: "", contextSize: 2048, maxNumSeqs: 4, dtype: "float32", kvCacheGb: 2, extraArgs: [] },
|
||||
});
|
||||
assert.equal(cmd.port, 8000);
|
||||
assert.equal(cmd.args[0], "/models/HuggingFaceTB/SmolLM2-135M-Instruct");
|
||||
assert.equal(cmd.env.VLLM_CPU_KVCACHE_SPACE, "2");
|
||||
const s = cmd.args.join(" ");
|
||||
assert.ok(s.indexOf("--dtype=bfloat16") < s.indexOf("--dtype float32"));
|
||||
assert.match(renderCommand("vllm/vllm-openai-cpu:v0.31.0", cmd), /^docker run -e VLLM_CPU_KVCACHE_SPACE=2 /);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user