Merge feat/parakeet-engine: Parakeet TDT 0.6B v3 English engine (spec 001 workstream 7)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

# Conflicts:
#	AGENTS.md
#	bun.lock
#	docs/Decisions.md
#	src/lib/models.ts
#	src/worker/inference.worker.ts
#	src/worker/protocol.ts
#	tests/models.test.ts
This commit is contained in:
Lucas Winther committed 2026-10-30 01:46:51 +01:00
commit 30969e86b7
29 files changed
+1741 -54

No files matched your search

+48 -3
View File
@@ -10,6 +10,8 @@ import {
formatModelSize,
getFasterWhisperModel,
getModel,
modelFamily,
PARAKEET_MODEL_ID,
resolveDefaultDtype,
taskForModel,
} from "../src/lib/models";
@@ -21,6 +23,8 @@ function stripRepoDecorations(id: string): string {
return id.replace(/(_timestamped|-ONNX)$/, "");
}
const WHISPER_MODELS = MODELS.filter((model) => modelFamily(model) === "whisper");
describe("MODELS catalog", () => {
test("contains the curated D-006 lineup from the onnx-community org", () => {
const ids = MODELS.map((model) => model.id);
@@ -35,12 +39,15 @@ describe("MODELS catalog", () => {
"onnx-community/whisper-medium-ONNX",
"onnx-community/whisper-large-v3-turbo",
`${DANISH_MODELS_HF_OWNER}/whisper-small-danish-ONNX`,
// Not Whisper: the D-WS7a Parakeet engine path, last so it never
// becomes anyone's accidental default.
"ysdede/parakeet-tdt-0.6b-v3-onnx",
]);
expect(new Set(ids).size).toBe(ids.length);
});
test(".en variants are English-only; the rest are multilingual", () => {
for (const model of MODELS) {
for (const model of WHISPER_MODELS) {
// Hub repo names may carry decorations (e.g. "_timestamped", "-ONNX")
// after the size suffix — judge English-ness on the undecorated name.
expect(model.multilingual).toBe(!stripRepoDecorations(model.id).endsWith(".en"));
@@ -72,10 +79,10 @@ describe("MODELS catalog", () => {
expect(getModel("onnx-community/whisper-nonexistent")).toBeUndefined();
});
test("every model maps to a faster-whisper name for the server engine (D-013)", () => {
test("every Whisper model maps to a faster-whisper name for the server engine (D-013)", () => {
// The Danish conversions (D-WS6a) have no faster-whisper alias; their
// server-engine name is a Hub repo id — covered by the Danish suite below.
for (const model of MODELS.filter((m) => !m.id.startsWith(`${DANISH_MODELS_HF_OWNER}/`))) {
for (const model of WHISPER_MODELS.filter((m) => !m.id.startsWith(`${DANISH_MODELS_HF_OWNER}/`))) {
// The onnx-community ids and faster-whisper's aliases share the same
// size suffix ("tiny.en", …, "large-v3-turbo") once repo-name
// decorations ("_timestamped", "-ONNX") are stripped; keeping them
@@ -298,3 +305,41 @@ describe("taskForModel (D-WS4a)", () => {
expect(taskForModel("someone/unknown", "translate")).toBe("transcribe");
});
});
describe("Parakeet catalog entry (D-WS7a)", () => {
const parakeet = getModel(PARAKEET_MODEL_ID)!;
test("family defaults to whisper when absent", () => {
expect(modelFamily(getModel(DEFAULT_MODEL_ID))).toBe("whisper");
expect(modelFamily(undefined)).toBe("whisper");
expect(modelFamily(parakeet)).toBe("parakeet");
});
test("is English-only and browser-only (no faster-whisper name)", () => {
expect(parakeet.multilingual).toBe(false);
expect(parakeet.fasterWhisperModel).toBeUndefined();
expect(getFasterWhisperModel(PARAKEET_MODEL_ID)).toBeUndefined();
});
test("WASM runs int8 for both parts; WebGPU is fp16 encoder + int8 decoder", () => {
expect(resolveDefaultDtype(PARAKEET_MODEL_ID, "wasm")).toBe("q8");
expect(resolveDefaultDtype(PARAKEET_MODEL_ID, "webgpu")).toEqual({
encoder_model: "fp16",
decoder_model_merged: "q8",
});
});
test("download size is the real file sizes, not a parameter estimate", () => {
expect(estimateDefaultDownloadBytes(parakeet, "wasm")).toBe(
652_183_999 + 18_202_004 + 102_132,
);
expect(estimateDefaultDownloadBytes(parakeet, "webgpu")).toBe(
1_238_960_452 + 18_202_004 + 102_132,
);
expect(formatModelSize(estimateDefaultDownloadBytes(parakeet, "wasm"))).toBe("670 MB");
});
test("peak load memory is twice the larger weight file", () => {
expect(estimatePeakLoadBytes(parakeet, "q8")).toBe(2 * 652_183_999);
});
});