@storyteller-platform/ghost-story 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/config.cjs +37 -4
- package/dist/cli/config.d.cts +6 -5
- package/dist/cli/config.d.ts +6 -5
- package/dist/cli/config.js +36 -4
- package/dist/index.cjs +2 -0
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -0
- package/package.json +1 -1
package/dist/cli/config.cjs
CHANGED
|
@@ -38,6 +38,7 @@ __export(config_exports, {
|
|
|
38
38
|
WHISPER_CPP_VERSION: () => WHISPER_CPP_VERSION,
|
|
39
39
|
WHISPER_MODELS: () => WHISPER_MODELS,
|
|
40
40
|
WHISPER_MODEL_VERSION: () => WHISPER_MODEL_VERSION,
|
|
41
|
+
applyLegacyCpuFallback: () => applyLegacyCpuFallback,
|
|
41
42
|
cliConfigSchema: () => cliConfigSchema,
|
|
42
43
|
detectPlatform: () => detectPlatform,
|
|
43
44
|
getBinaryDownloadUrl: () => getBinaryDownloadUrl,
|
|
@@ -89,6 +90,7 @@ const BUILD_VARIANTS = [
|
|
|
89
90
|
"linux-x64-rocm",
|
|
90
91
|
"linux-x64-blas",
|
|
91
92
|
"linux-x64-cpu",
|
|
93
|
+
"linux-x64-cpu-legacy",
|
|
92
94
|
"linux-arm64-cpu",
|
|
93
95
|
"windows-x64-cpu",
|
|
94
96
|
"windows-x64-cuda-13.1.0",
|
|
@@ -313,6 +315,36 @@ function hasSycl() {
|
|
|
313
315
|
return false;
|
|
314
316
|
}
|
|
315
317
|
}
|
|
318
|
+
let cpuCapabilitiesCache = null;
|
|
319
|
+
function getLinuxCpuCapabilities() {
|
|
320
|
+
if (cpuCapabilitiesCache) return cpuCapabilitiesCache;
|
|
321
|
+
try {
|
|
322
|
+
const cpuinfo = (0, import_node_fs.readFileSync)("/proc/cpuinfo", "utf-8");
|
|
323
|
+
const flagsMatch = cpuinfo.match(/^flags\s*:\s*(.+)$/m);
|
|
324
|
+
if (!(flagsMatch == null ? void 0 : flagsMatch[1])) {
|
|
325
|
+
cpuCapabilitiesCache = { avx2: false, fma: false };
|
|
326
|
+
return cpuCapabilitiesCache;
|
|
327
|
+
}
|
|
328
|
+
const flags = flagsMatch[1].split(/\s+/);
|
|
329
|
+
cpuCapabilitiesCache = {
|
|
330
|
+
avx2: flags.includes("avx2"),
|
|
331
|
+
fma: flags.includes("fma")
|
|
332
|
+
};
|
|
333
|
+
} catch {
|
|
334
|
+
cpuCapabilitiesCache = { avx2: true, fma: true };
|
|
335
|
+
}
|
|
336
|
+
return cpuCapabilitiesCache;
|
|
337
|
+
}
|
|
338
|
+
function applyLegacyCpuFallback(variant) {
|
|
339
|
+
if (process.platform !== "linux") return variant;
|
|
340
|
+
if (variant !== "linux-x64-cpu") return variant;
|
|
341
|
+
const caps = getLinuxCpuCapabilities();
|
|
342
|
+
if (caps.avx2 && caps.fma) return variant;
|
|
343
|
+
console.warn(
|
|
344
|
+
`CPU lacks ${[!caps.avx2 && "AVX2", !caps.fma && "FMA"].filter(Boolean).join(" and ")} support. Falling back to linux-x64-cpu-legacy variant.`
|
|
345
|
+
);
|
|
346
|
+
return "linux-x64-cpu-legacy";
|
|
347
|
+
}
|
|
316
348
|
function getConfiguredVariant() {
|
|
317
349
|
const envVariant = process.env["STORYTELLER_WHISPER_VARIANT"];
|
|
318
350
|
if (!envVariant || envVariant === "") {
|
|
@@ -366,20 +398,20 @@ function detectPlatform() {
|
|
|
366
398
|
}
|
|
367
399
|
function resolveVariant(requestedVariant) {
|
|
368
400
|
if (requestedVariant) {
|
|
369
|
-
return requestedVariant;
|
|
401
|
+
return applyLegacyCpuFallback(requestedVariant);
|
|
370
402
|
}
|
|
371
403
|
const configured = getConfiguredVariant();
|
|
372
404
|
if (configured) {
|
|
373
|
-
return configured;
|
|
405
|
+
return applyLegacyCpuFallback(configured);
|
|
374
406
|
}
|
|
375
407
|
const installed = getInstalledVariant();
|
|
376
408
|
if (installed) {
|
|
377
|
-
return installed;
|
|
409
|
+
return applyLegacyCpuFallback(installed);
|
|
378
410
|
}
|
|
379
411
|
console.warn(
|
|
380
412
|
"No variant configured or installed. Falling back to platform detection."
|
|
381
413
|
);
|
|
382
|
-
return detectPlatform();
|
|
414
|
+
return applyLegacyCpuFallback(detectPlatform());
|
|
383
415
|
}
|
|
384
416
|
function isValidModel(model) {
|
|
385
417
|
return WHISPER_MODELS.includes(model);
|
|
@@ -442,6 +474,7 @@ function writeConfig(config) {
|
|
|
442
474
|
WHISPER_CPP_VERSION,
|
|
443
475
|
WHISPER_MODELS,
|
|
444
476
|
WHISPER_MODEL_VERSION,
|
|
477
|
+
applyLegacyCpuFallback,
|
|
445
478
|
cliConfigSchema,
|
|
446
479
|
detectPlatform,
|
|
447
480
|
getBinaryDownloadUrl,
|
package/dist/cli/config.d.cts
CHANGED
|
@@ -6,7 +6,7 @@ declare const SILERO_VAD_VERSION = "6.2.0";
|
|
|
6
6
|
declare const GITLAB_PROJECT_PATH = "storyteller-platform/storyteller";
|
|
7
7
|
declare const GITLAB_PROJECT_ID = "67994333";
|
|
8
8
|
declare const GITLAB_WHIPSER_ML_ID = "2007349";
|
|
9
|
-
declare const BUILD_VARIANTS: readonly ["darwin-arm64-coreml", "darwin-arm64-cpu", "darwin-x64-cpu", "linux-x64-cuda-13.1.0", "linux-x64-cuda-12.9.0", "linux-x64-cuda-11.8.0", "linux-x64-sycl", "linux-x64-vulkan", "linux-x64-rocm", "linux-x64-blas", "linux-x64-cpu", "linux-arm64-cpu", "windows-x64-cpu", "windows-x64-cuda-13.1.0", "windows-x64-cuda-12.9.0", "windows-x64-cuda-11.8.0", "windows-x64-vulkan"];
|
|
9
|
+
declare const BUILD_VARIANTS: readonly ["darwin-arm64-coreml", "darwin-arm64-cpu", "darwin-x64-cpu", "linux-x64-cuda-13.1.0", "linux-x64-cuda-12.9.0", "linux-x64-cuda-11.8.0", "linux-x64-sycl", "linux-x64-vulkan", "linux-x64-rocm", "linux-x64-blas", "linux-x64-cpu", "linux-x64-cpu-legacy", "linux-arm64-cpu", "windows-x64-cpu", "windows-x64-cuda-13.1.0", "windows-x64-cuda-12.9.0", "windows-x64-cuda-11.8.0", "windows-x64-vulkan"];
|
|
10
10
|
type BuildVariant = (typeof BUILD_VARIANTS)[number];
|
|
11
11
|
declare function isVariantCompatibleWithCurrentPlatform(variant: BuildVariant): boolean;
|
|
12
12
|
declare function getCompatibleVariants(): BuildVariant[];
|
|
@@ -32,6 +32,7 @@ declare function getModelPath(model: WhisperModel, modelDir?: string): string;
|
|
|
32
32
|
declare function getCoremlModelPath(model: WhisperModel, modelDir?: string): string;
|
|
33
33
|
declare function needsCoremlModel(variant?: BuildVariant): boolean;
|
|
34
34
|
declare function getVadModelPath(modelDir?: string): string;
|
|
35
|
+
declare function applyLegacyCpuFallback(variant: BuildVariant): BuildVariant;
|
|
35
36
|
/**
|
|
36
37
|
* neturns the variant configured via STORYTELLER_WHISPER_VARIANT env var.
|
|
37
38
|
* set by the Docker build process and should be the primary source
|
|
@@ -56,13 +57,13 @@ declare function isValidModel(model: string): model is WhisperModel;
|
|
|
56
57
|
declare function isValidVariant(variant: string): variant is BuildVariant;
|
|
57
58
|
declare const cliConfigSchema: z.ZodObject<{
|
|
58
59
|
lastUsedModel: z.ZodNullable<z.ZodEnum<["tiny", "tiny.en", "tiny-q5_1", "tiny.en-q5_1", "tiny-q8_0", "base", "base.en", "base-q5_1", "base.en-q5_1", "base-q8_0", "small", "small.en", "small-q5_1", "small.en-q5_1", "small-q8_0", "medium", "medium.en", "medium-q5_0", "medium.en-q5_0", "medium-q8_0", "large-v1", "large-v2", "large-v2-q5_0", "large-v2-q8_0", "large-v3", "large-v3-q5_0", "large-v3-turbo", "large-v3-turbo-q5_0", "large-v3-turbo-q8_0"]>>;
|
|
59
|
-
installedVariant: z.ZodNullable<z.ZodEnum<["darwin-arm64-coreml", "darwin-arm64-cpu", "darwin-x64-cpu", "linux-x64-cuda-13.1.0", "linux-x64-cuda-12.9.0", "linux-x64-cuda-11.8.0", "linux-x64-sycl", "linux-x64-vulkan", "linux-x64-rocm", "linux-x64-blas", "linux-x64-cpu", "linux-arm64-cpu", "windows-x64-cpu", "windows-x64-cuda-13.1.0", "windows-x64-cuda-12.9.0", "windows-x64-cuda-11.8.0", "windows-x64-vulkan"]>>;
|
|
60
|
+
installedVariant: z.ZodNullable<z.ZodEnum<["darwin-arm64-coreml", "darwin-arm64-cpu", "darwin-x64-cpu", "linux-x64-cuda-13.1.0", "linux-x64-cuda-12.9.0", "linux-x64-cuda-11.8.0", "linux-x64-sycl", "linux-x64-vulkan", "linux-x64-rocm", "linux-x64-blas", "linux-x64-cpu", "linux-x64-cpu-legacy", "linux-arm64-cpu", "windows-x64-cpu", "windows-x64-cuda-13.1.0", "windows-x64-cuda-12.9.0", "windows-x64-cuda-11.8.0", "windows-x64-vulkan"]>>;
|
|
60
61
|
}, "strip", z.ZodTypeAny, {
|
|
61
62
|
lastUsedModel: "tiny" | "tiny.en" | "tiny-q5_1" | "tiny.en-q5_1" | "tiny-q8_0" | "base" | "base.en" | "base-q5_1" | "base.en-q5_1" | "base-q8_0" | "small" | "small.en" | "small-q5_1" | "small.en-q5_1" | "small-q8_0" | "medium" | "medium.en" | "medium-q5_0" | "medium.en-q5_0" | "medium-q8_0" | "large-v1" | "large-v2" | "large-v2-q5_0" | "large-v2-q8_0" | "large-v3" | "large-v3-q5_0" | "large-v3-turbo" | "large-v3-turbo-q5_0" | "large-v3-turbo-q8_0" | null;
|
|
62
|
-
installedVariant: "darwin-arm64-coreml" | "darwin-arm64-cpu" | "darwin-x64-cpu" | "linux-x64-cuda-13.1.0" | "linux-x64-cuda-12.9.0" | "linux-x64-cuda-11.8.0" | "linux-x64-sycl" | "linux-x64-vulkan" | "linux-x64-rocm" | "linux-x64-blas" | "linux-x64-cpu" | "linux-arm64-cpu" | "windows-x64-cpu" | "windows-x64-cuda-13.1.0" | "windows-x64-cuda-12.9.0" | "windows-x64-cuda-11.8.0" | "windows-x64-vulkan" | null;
|
|
63
|
+
installedVariant: "darwin-arm64-coreml" | "darwin-arm64-cpu" | "darwin-x64-cpu" | "linux-x64-cuda-13.1.0" | "linux-x64-cuda-12.9.0" | "linux-x64-cuda-11.8.0" | "linux-x64-sycl" | "linux-x64-vulkan" | "linux-x64-rocm" | "linux-x64-blas" | "linux-x64-cpu" | "linux-x64-cpu-legacy" | "linux-arm64-cpu" | "windows-x64-cpu" | "windows-x64-cuda-13.1.0" | "windows-x64-cuda-12.9.0" | "windows-x64-cuda-11.8.0" | "windows-x64-vulkan" | null;
|
|
63
64
|
}, {
|
|
64
65
|
lastUsedModel: "tiny" | "tiny.en" | "tiny-q5_1" | "tiny.en-q5_1" | "tiny-q8_0" | "base" | "base.en" | "base-q5_1" | "base.en-q5_1" | "base-q8_0" | "small" | "small.en" | "small-q5_1" | "small.en-q5_1" | "small-q8_0" | "medium" | "medium.en" | "medium-q5_0" | "medium.en-q5_0" | "medium-q8_0" | "large-v1" | "large-v2" | "large-v2-q5_0" | "large-v2-q8_0" | "large-v3" | "large-v3-q5_0" | "large-v3-turbo" | "large-v3-turbo-q5_0" | "large-v3-turbo-q8_0" | null;
|
|
65
|
-
installedVariant: "darwin-arm64-coreml" | "darwin-arm64-cpu" | "darwin-x64-cpu" | "linux-x64-cuda-13.1.0" | "linux-x64-cuda-12.9.0" | "linux-x64-cuda-11.8.0" | "linux-x64-sycl" | "linux-x64-vulkan" | "linux-x64-rocm" | "linux-x64-blas" | "linux-x64-cpu" | "linux-arm64-cpu" | "windows-x64-cpu" | "windows-x64-cuda-13.1.0" | "windows-x64-cuda-12.9.0" | "windows-x64-cuda-11.8.0" | "windows-x64-vulkan" | null;
|
|
66
|
+
installedVariant: "darwin-arm64-coreml" | "darwin-arm64-cpu" | "darwin-x64-cpu" | "linux-x64-cuda-13.1.0" | "linux-x64-cuda-12.9.0" | "linux-x64-cuda-11.8.0" | "linux-x64-sycl" | "linux-x64-vulkan" | "linux-x64-rocm" | "linux-x64-blas" | "linux-x64-cpu" | "linux-x64-cpu-legacy" | "linux-arm64-cpu" | "windows-x64-cpu" | "windows-x64-cuda-13.1.0" | "windows-x64-cuda-12.9.0" | "windows-x64-cuda-11.8.0" | "windows-x64-vulkan" | null;
|
|
66
67
|
}>;
|
|
67
68
|
/**
|
|
68
69
|
* Only to be used by the CLI, not the API/programmatic use.
|
|
@@ -72,4 +73,4 @@ type CLIConfig = z.infer<typeof cliConfigSchema>;
|
|
|
72
73
|
declare function readConfig(): CLIConfig;
|
|
73
74
|
declare function writeConfig(config: Partial<CLIConfig>): void;
|
|
74
75
|
|
|
75
|
-
export { BUILD_VARIANTS, type BuildVariant, type CLIConfig, GITLAB_PROJECT_ID, GITLAB_PROJECT_PATH, GITLAB_WHIPSER_ML_ID, MODEL_SIZES, RECOGNITION_ENGINES, SILERO_VAD_VERSION, WHISPER_CPP_VERSION, WHISPER_MODELS, WHISPER_MODEL_VERSION, type WhisperModel, cliConfigSchema, detectPlatform, getBinaryDownloadUrl, getCompatibleVariants, getConfiguredVariant, getCoremlModelDownloadUrl, getCoremlModelPath, getInstallDir, getInstalledVariant, getModelDir, getModelDownloadUrl, getModelPath, getVadExecutablePath, getVadModelDownloadUrl, getVadModelPath, getWhisperBaseDir, getWhisperExecutablePath, getWhisperServerExecutablePath, isValidModel, isValidVariant, isVariantCompatibleWithCurrentPlatform, needsCoremlModel, readConfig, resolveVariant, writeConfig };
|
|
76
|
+
export { BUILD_VARIANTS, type BuildVariant, type CLIConfig, GITLAB_PROJECT_ID, GITLAB_PROJECT_PATH, GITLAB_WHIPSER_ML_ID, MODEL_SIZES, RECOGNITION_ENGINES, SILERO_VAD_VERSION, WHISPER_CPP_VERSION, WHISPER_MODELS, WHISPER_MODEL_VERSION, type WhisperModel, applyLegacyCpuFallback, cliConfigSchema, detectPlatform, getBinaryDownloadUrl, getCompatibleVariants, getConfiguredVariant, getCoremlModelDownloadUrl, getCoremlModelPath, getInstallDir, getInstalledVariant, getModelDir, getModelDownloadUrl, getModelPath, getVadExecutablePath, getVadModelDownloadUrl, getVadModelPath, getWhisperBaseDir, getWhisperExecutablePath, getWhisperServerExecutablePath, isValidModel, isValidVariant, isVariantCompatibleWithCurrentPlatform, needsCoremlModel, readConfig, resolveVariant, writeConfig };
|
package/dist/cli/config.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ declare const SILERO_VAD_VERSION = "6.2.0";
|
|
|
6
6
|
declare const GITLAB_PROJECT_PATH = "storyteller-platform/storyteller";
|
|
7
7
|
declare const GITLAB_PROJECT_ID = "67994333";
|
|
8
8
|
declare const GITLAB_WHIPSER_ML_ID = "2007349";
|
|
9
|
-
declare const BUILD_VARIANTS: readonly ["darwin-arm64-coreml", "darwin-arm64-cpu", "darwin-x64-cpu", "linux-x64-cuda-13.1.0", "linux-x64-cuda-12.9.0", "linux-x64-cuda-11.8.0", "linux-x64-sycl", "linux-x64-vulkan", "linux-x64-rocm", "linux-x64-blas", "linux-x64-cpu", "linux-arm64-cpu", "windows-x64-cpu", "windows-x64-cuda-13.1.0", "windows-x64-cuda-12.9.0", "windows-x64-cuda-11.8.0", "windows-x64-vulkan"];
|
|
9
|
+
declare const BUILD_VARIANTS: readonly ["darwin-arm64-coreml", "darwin-arm64-cpu", "darwin-x64-cpu", "linux-x64-cuda-13.1.0", "linux-x64-cuda-12.9.0", "linux-x64-cuda-11.8.0", "linux-x64-sycl", "linux-x64-vulkan", "linux-x64-rocm", "linux-x64-blas", "linux-x64-cpu", "linux-x64-cpu-legacy", "linux-arm64-cpu", "windows-x64-cpu", "windows-x64-cuda-13.1.0", "windows-x64-cuda-12.9.0", "windows-x64-cuda-11.8.0", "windows-x64-vulkan"];
|
|
10
10
|
type BuildVariant = (typeof BUILD_VARIANTS)[number];
|
|
11
11
|
declare function isVariantCompatibleWithCurrentPlatform(variant: BuildVariant): boolean;
|
|
12
12
|
declare function getCompatibleVariants(): BuildVariant[];
|
|
@@ -32,6 +32,7 @@ declare function getModelPath(model: WhisperModel, modelDir?: string): string;
|
|
|
32
32
|
declare function getCoremlModelPath(model: WhisperModel, modelDir?: string): string;
|
|
33
33
|
declare function needsCoremlModel(variant?: BuildVariant): boolean;
|
|
34
34
|
declare function getVadModelPath(modelDir?: string): string;
|
|
35
|
+
declare function applyLegacyCpuFallback(variant: BuildVariant): BuildVariant;
|
|
35
36
|
/**
|
|
36
37
|
* neturns the variant configured via STORYTELLER_WHISPER_VARIANT env var.
|
|
37
38
|
* set by the Docker build process and should be the primary source
|
|
@@ -56,13 +57,13 @@ declare function isValidModel(model: string): model is WhisperModel;
|
|
|
56
57
|
declare function isValidVariant(variant: string): variant is BuildVariant;
|
|
57
58
|
declare const cliConfigSchema: z.ZodObject<{
|
|
58
59
|
lastUsedModel: z.ZodNullable<z.ZodEnum<["tiny", "tiny.en", "tiny-q5_1", "tiny.en-q5_1", "tiny-q8_0", "base", "base.en", "base-q5_1", "base.en-q5_1", "base-q8_0", "small", "small.en", "small-q5_1", "small.en-q5_1", "small-q8_0", "medium", "medium.en", "medium-q5_0", "medium.en-q5_0", "medium-q8_0", "large-v1", "large-v2", "large-v2-q5_0", "large-v2-q8_0", "large-v3", "large-v3-q5_0", "large-v3-turbo", "large-v3-turbo-q5_0", "large-v3-turbo-q8_0"]>>;
|
|
59
|
-
installedVariant: z.ZodNullable<z.ZodEnum<["darwin-arm64-coreml", "darwin-arm64-cpu", "darwin-x64-cpu", "linux-x64-cuda-13.1.0", "linux-x64-cuda-12.9.0", "linux-x64-cuda-11.8.0", "linux-x64-sycl", "linux-x64-vulkan", "linux-x64-rocm", "linux-x64-blas", "linux-x64-cpu", "linux-arm64-cpu", "windows-x64-cpu", "windows-x64-cuda-13.1.0", "windows-x64-cuda-12.9.0", "windows-x64-cuda-11.8.0", "windows-x64-vulkan"]>>;
|
|
60
|
+
installedVariant: z.ZodNullable<z.ZodEnum<["darwin-arm64-coreml", "darwin-arm64-cpu", "darwin-x64-cpu", "linux-x64-cuda-13.1.0", "linux-x64-cuda-12.9.0", "linux-x64-cuda-11.8.0", "linux-x64-sycl", "linux-x64-vulkan", "linux-x64-rocm", "linux-x64-blas", "linux-x64-cpu", "linux-x64-cpu-legacy", "linux-arm64-cpu", "windows-x64-cpu", "windows-x64-cuda-13.1.0", "windows-x64-cuda-12.9.0", "windows-x64-cuda-11.8.0", "windows-x64-vulkan"]>>;
|
|
60
61
|
}, "strip", z.ZodTypeAny, {
|
|
61
62
|
lastUsedModel: "tiny" | "tiny.en" | "tiny-q5_1" | "tiny.en-q5_1" | "tiny-q8_0" | "base" | "base.en" | "base-q5_1" | "base.en-q5_1" | "base-q8_0" | "small" | "small.en" | "small-q5_1" | "small.en-q5_1" | "small-q8_0" | "medium" | "medium.en" | "medium-q5_0" | "medium.en-q5_0" | "medium-q8_0" | "large-v1" | "large-v2" | "large-v2-q5_0" | "large-v2-q8_0" | "large-v3" | "large-v3-q5_0" | "large-v3-turbo" | "large-v3-turbo-q5_0" | "large-v3-turbo-q8_0" | null;
|
|
62
|
-
installedVariant: "darwin-arm64-coreml" | "darwin-arm64-cpu" | "darwin-x64-cpu" | "linux-x64-cuda-13.1.0" | "linux-x64-cuda-12.9.0" | "linux-x64-cuda-11.8.0" | "linux-x64-sycl" | "linux-x64-vulkan" | "linux-x64-rocm" | "linux-x64-blas" | "linux-x64-cpu" | "linux-arm64-cpu" | "windows-x64-cpu" | "windows-x64-cuda-13.1.0" | "windows-x64-cuda-12.9.0" | "windows-x64-cuda-11.8.0" | "windows-x64-vulkan" | null;
|
|
63
|
+
installedVariant: "darwin-arm64-coreml" | "darwin-arm64-cpu" | "darwin-x64-cpu" | "linux-x64-cuda-13.1.0" | "linux-x64-cuda-12.9.0" | "linux-x64-cuda-11.8.0" | "linux-x64-sycl" | "linux-x64-vulkan" | "linux-x64-rocm" | "linux-x64-blas" | "linux-x64-cpu" | "linux-x64-cpu-legacy" | "linux-arm64-cpu" | "windows-x64-cpu" | "windows-x64-cuda-13.1.0" | "windows-x64-cuda-12.9.0" | "windows-x64-cuda-11.8.0" | "windows-x64-vulkan" | null;
|
|
63
64
|
}, {
|
|
64
65
|
lastUsedModel: "tiny" | "tiny.en" | "tiny-q5_1" | "tiny.en-q5_1" | "tiny-q8_0" | "base" | "base.en" | "base-q5_1" | "base.en-q5_1" | "base-q8_0" | "small" | "small.en" | "small-q5_1" | "small.en-q5_1" | "small-q8_0" | "medium" | "medium.en" | "medium-q5_0" | "medium.en-q5_0" | "medium-q8_0" | "large-v1" | "large-v2" | "large-v2-q5_0" | "large-v2-q8_0" | "large-v3" | "large-v3-q5_0" | "large-v3-turbo" | "large-v3-turbo-q5_0" | "large-v3-turbo-q8_0" | null;
|
|
65
|
-
installedVariant: "darwin-arm64-coreml" | "darwin-arm64-cpu" | "darwin-x64-cpu" | "linux-x64-cuda-13.1.0" | "linux-x64-cuda-12.9.0" | "linux-x64-cuda-11.8.0" | "linux-x64-sycl" | "linux-x64-vulkan" | "linux-x64-rocm" | "linux-x64-blas" | "linux-x64-cpu" | "linux-arm64-cpu" | "windows-x64-cpu" | "windows-x64-cuda-13.1.0" | "windows-x64-cuda-12.9.0" | "windows-x64-cuda-11.8.0" | "windows-x64-vulkan" | null;
|
|
66
|
+
installedVariant: "darwin-arm64-coreml" | "darwin-arm64-cpu" | "darwin-x64-cpu" | "linux-x64-cuda-13.1.0" | "linux-x64-cuda-12.9.0" | "linux-x64-cuda-11.8.0" | "linux-x64-sycl" | "linux-x64-vulkan" | "linux-x64-rocm" | "linux-x64-blas" | "linux-x64-cpu" | "linux-x64-cpu-legacy" | "linux-arm64-cpu" | "windows-x64-cpu" | "windows-x64-cuda-13.1.0" | "windows-x64-cuda-12.9.0" | "windows-x64-cuda-11.8.0" | "windows-x64-vulkan" | null;
|
|
66
67
|
}>;
|
|
67
68
|
/**
|
|
68
69
|
* Only to be used by the CLI, not the API/programmatic use.
|
|
@@ -72,4 +73,4 @@ type CLIConfig = z.infer<typeof cliConfigSchema>;
|
|
|
72
73
|
declare function readConfig(): CLIConfig;
|
|
73
74
|
declare function writeConfig(config: Partial<CLIConfig>): void;
|
|
74
75
|
|
|
75
|
-
export { BUILD_VARIANTS, type BuildVariant, type CLIConfig, GITLAB_PROJECT_ID, GITLAB_PROJECT_PATH, GITLAB_WHIPSER_ML_ID, MODEL_SIZES, RECOGNITION_ENGINES, SILERO_VAD_VERSION, WHISPER_CPP_VERSION, WHISPER_MODELS, WHISPER_MODEL_VERSION, type WhisperModel, cliConfigSchema, detectPlatform, getBinaryDownloadUrl, getCompatibleVariants, getConfiguredVariant, getCoremlModelDownloadUrl, getCoremlModelPath, getInstallDir, getInstalledVariant, getModelDir, getModelDownloadUrl, getModelPath, getVadExecutablePath, getVadModelDownloadUrl, getVadModelPath, getWhisperBaseDir, getWhisperExecutablePath, getWhisperServerExecutablePath, isValidModel, isValidVariant, isVariantCompatibleWithCurrentPlatform, needsCoremlModel, readConfig, resolveVariant, writeConfig };
|
|
76
|
+
export { BUILD_VARIANTS, type BuildVariant, type CLIConfig, GITLAB_PROJECT_ID, GITLAB_PROJECT_PATH, GITLAB_WHIPSER_ML_ID, MODEL_SIZES, RECOGNITION_ENGINES, SILERO_VAD_VERSION, WHISPER_CPP_VERSION, WHISPER_MODELS, WHISPER_MODEL_VERSION, type WhisperModel, applyLegacyCpuFallback, cliConfigSchema, detectPlatform, getBinaryDownloadUrl, getCompatibleVariants, getConfiguredVariant, getCoremlModelDownloadUrl, getCoremlModelPath, getInstallDir, getInstalledVariant, getModelDir, getModelDownloadUrl, getModelPath, getVadExecutablePath, getVadModelDownloadUrl, getVadModelPath, getWhisperBaseDir, getWhisperExecutablePath, getWhisperServerExecutablePath, isValidModel, isValidVariant, isVariantCompatibleWithCurrentPlatform, needsCoremlModel, readConfig, resolveVariant, writeConfig };
|
package/dist/cli/config.js
CHANGED
|
@@ -22,6 +22,7 @@ const BUILD_VARIANTS = [
|
|
|
22
22
|
"linux-x64-rocm",
|
|
23
23
|
"linux-x64-blas",
|
|
24
24
|
"linux-x64-cpu",
|
|
25
|
+
"linux-x64-cpu-legacy",
|
|
25
26
|
"linux-arm64-cpu",
|
|
26
27
|
"windows-x64-cpu",
|
|
27
28
|
"windows-x64-cuda-13.1.0",
|
|
@@ -246,6 +247,36 @@ function hasSycl() {
|
|
|
246
247
|
return false;
|
|
247
248
|
}
|
|
248
249
|
}
|
|
250
|
+
let cpuCapabilitiesCache = null;
|
|
251
|
+
function getLinuxCpuCapabilities() {
|
|
252
|
+
if (cpuCapabilitiesCache) return cpuCapabilitiesCache;
|
|
253
|
+
try {
|
|
254
|
+
const cpuinfo = readFileSync("/proc/cpuinfo", "utf-8");
|
|
255
|
+
const flagsMatch = cpuinfo.match(/^flags\s*:\s*(.+)$/m);
|
|
256
|
+
if (!(flagsMatch == null ? void 0 : flagsMatch[1])) {
|
|
257
|
+
cpuCapabilitiesCache = { avx2: false, fma: false };
|
|
258
|
+
return cpuCapabilitiesCache;
|
|
259
|
+
}
|
|
260
|
+
const flags = flagsMatch[1].split(/\s+/);
|
|
261
|
+
cpuCapabilitiesCache = {
|
|
262
|
+
avx2: flags.includes("avx2"),
|
|
263
|
+
fma: flags.includes("fma")
|
|
264
|
+
};
|
|
265
|
+
} catch {
|
|
266
|
+
cpuCapabilitiesCache = { avx2: true, fma: true };
|
|
267
|
+
}
|
|
268
|
+
return cpuCapabilitiesCache;
|
|
269
|
+
}
|
|
270
|
+
function applyLegacyCpuFallback(variant) {
|
|
271
|
+
if (process.platform !== "linux") return variant;
|
|
272
|
+
if (variant !== "linux-x64-cpu") return variant;
|
|
273
|
+
const caps = getLinuxCpuCapabilities();
|
|
274
|
+
if (caps.avx2 && caps.fma) return variant;
|
|
275
|
+
console.warn(
|
|
276
|
+
`CPU lacks ${[!caps.avx2 && "AVX2", !caps.fma && "FMA"].filter(Boolean).join(" and ")} support. Falling back to linux-x64-cpu-legacy variant.`
|
|
277
|
+
);
|
|
278
|
+
return "linux-x64-cpu-legacy";
|
|
279
|
+
}
|
|
249
280
|
function getConfiguredVariant() {
|
|
250
281
|
const envVariant = process.env["STORYTELLER_WHISPER_VARIANT"];
|
|
251
282
|
if (!envVariant || envVariant === "") {
|
|
@@ -299,20 +330,20 @@ function detectPlatform() {
|
|
|
299
330
|
}
|
|
300
331
|
function resolveVariant(requestedVariant) {
|
|
301
332
|
if (requestedVariant) {
|
|
302
|
-
return requestedVariant;
|
|
333
|
+
return applyLegacyCpuFallback(requestedVariant);
|
|
303
334
|
}
|
|
304
335
|
const configured = getConfiguredVariant();
|
|
305
336
|
if (configured) {
|
|
306
|
-
return configured;
|
|
337
|
+
return applyLegacyCpuFallback(configured);
|
|
307
338
|
}
|
|
308
339
|
const installed = getInstalledVariant();
|
|
309
340
|
if (installed) {
|
|
310
|
-
return installed;
|
|
341
|
+
return applyLegacyCpuFallback(installed);
|
|
311
342
|
}
|
|
312
343
|
console.warn(
|
|
313
344
|
"No variant configured or installed. Falling back to platform detection."
|
|
314
345
|
);
|
|
315
|
-
return detectPlatform();
|
|
346
|
+
return applyLegacyCpuFallback(detectPlatform());
|
|
316
347
|
}
|
|
317
348
|
function isValidModel(model) {
|
|
318
349
|
return WHISPER_MODELS.includes(model);
|
|
@@ -374,6 +405,7 @@ export {
|
|
|
374
405
|
WHISPER_CPP_VERSION,
|
|
375
406
|
WHISPER_MODELS,
|
|
376
407
|
WHISPER_MODEL_VERSION,
|
|
408
|
+
applyLegacyCpuFallback,
|
|
377
409
|
cliConfigSchema,
|
|
378
410
|
detectPlatform,
|
|
379
411
|
getBinaryDownloadUrl,
|
package/dist/index.cjs
CHANGED
|
@@ -23,6 +23,7 @@ __export(index_exports, {
|
|
|
23
23
|
TimingAggregator: () => import_Timing.TimingAggregator,
|
|
24
24
|
WHISPER_CPP_VERSION: () => import_config.WHISPER_CPP_VERSION,
|
|
25
25
|
WHISPER_MODELS: () => import_config.WHISPER_MODELS,
|
|
26
|
+
applyLegacyCpuFallback: () => import_config.applyLegacyCpuFallback,
|
|
26
27
|
audioSourceFromBuffer: () => import_audio.audioSourceFromBuffer,
|
|
27
28
|
audioSourceFromFile: () => import_audio.audioSourceFromFile,
|
|
28
29
|
audioSourceFromStream: () => import_audio.audioSourceFromStream,
|
|
@@ -98,6 +99,7 @@ var import_Silero = require("./vad/Silero.cjs");
|
|
|
98
99
|
TimingAggregator,
|
|
99
100
|
WHISPER_CPP_VERSION,
|
|
100
101
|
WHISPER_MODELS,
|
|
102
|
+
applyLegacyCpuFallback,
|
|
101
103
|
audioSourceFromBuffer,
|
|
102
104
|
audioSourceFromFile,
|
|
103
105
|
audioSourceFromStream,
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { d as AudioFormat, e as AudioFormatInfo, A as AudioInput, f as AudioSource, g as AudioSourceFromBuffer, h as AudioSourceFromFile, i as AudioSourceFromStream, L as Language, O as OpenAICloudSTTOptions, B as OpenAIResult, j as RawAudioInput, R as RecognitionEngine, a as RecognitionOptions, b as RecognitionResult, S as ServiceCapabilities, W as WhisperCppModelId, F as WhisperCppOptions, E as WhisperCppResult, J as WhisperServerOptions, I as WhisperServerResult, k as audioSourceFromBuffer, l as audioSourceFromFile, m as audioSourceFromStream, n as formatFromExtension, o as formatToExtension, p as getFormat, q as getFormatInfo, s as getTargetFormat, t as isAudioSource, u as needsConversion, v as normalizeToAudioSource, C as openaiInputPreference, r as recognitionEngines, c as recognize, D as recognizeOpenAI, H as recognizeWhisperCpp, M as recognizeWhisperServer, w as serviceCapabilities, x as toBuffer, y as toFilePath, z as toReadStream, G as whisperCppInputPreference, K as whisperServerInputPreference } from './AudioFormat-BoGeaCbt.cjs';
|
|
2
2
|
export { ConversionOptions, PreparedAudio, convertToBuffer, convertToFile, createStreamingConversion, prepareForService, prepareWavForService } from './audio/AudioConverter.cjs';
|
|
3
|
-
export { BUILD_VARIANTS, BuildVariant, WHISPER_CPP_VERSION, WHISPER_MODELS, WhisperModel, detectPlatform, getConfiguredVariant, getInstallDir, getModelDir, getModelPath, getVadModelPath, getWhisperExecutablePath, getWhisperServerExecutablePath, isValidModel, resolveVariant } from './cli/config.cjs';
|
|
3
|
+
export { BUILD_VARIANTS, BuildVariant, WHISPER_CPP_VERSION, WHISPER_MODELS, WhisperModel, applyLegacyCpuFallback, detectPlatform, getConfiguredVariant, getInstallDir, getModelDir, getModelPath, getVadModelPath, getWhisperExecutablePath, getWhisperServerExecutablePath, isValidModel, resolveVariant } from './cli/config.cjs';
|
|
4
4
|
export { InstallBinaryOptions, InstallModelOptions, InstallVadModelOptions, ensureWhisperInstalled, installBinary, installModel, installVadModel } from './cli/install.cjs';
|
|
5
5
|
export { ConversionMode, getConfig, getConversionMode, isTimingEnabled, setConversionMode, setTimingEnabled } from './config.cjs';
|
|
6
6
|
export { Timeline, TimelineEntry, TimelineEntryType } from './utilities/Timeline.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { d as AudioFormat, e as AudioFormatInfo, A as AudioInput, f as AudioSource, g as AudioSourceFromBuffer, h as AudioSourceFromFile, i as AudioSourceFromStream, L as Language, O as OpenAICloudSTTOptions, B as OpenAIResult, j as RawAudioInput, R as RecognitionEngine, a as RecognitionOptions, b as RecognitionResult, S as ServiceCapabilities, W as WhisperCppModelId, F as WhisperCppOptions, E as WhisperCppResult, J as WhisperServerOptions, I as WhisperServerResult, k as audioSourceFromBuffer, l as audioSourceFromFile, m as audioSourceFromStream, n as formatFromExtension, o as formatToExtension, p as getFormat, q as getFormatInfo, s as getTargetFormat, t as isAudioSource, u as needsConversion, v as normalizeToAudioSource, C as openaiInputPreference, r as recognitionEngines, c as recognize, D as recognizeOpenAI, H as recognizeWhisperCpp, M as recognizeWhisperServer, w as serviceCapabilities, x as toBuffer, y as toFilePath, z as toReadStream, G as whisperCppInputPreference, K as whisperServerInputPreference } from './AudioFormat-DDo0cjUB.js';
|
|
2
2
|
export { ConversionOptions, PreparedAudio, convertToBuffer, convertToFile, createStreamingConversion, prepareForService, prepareWavForService } from './audio/AudioConverter.js';
|
|
3
|
-
export { BUILD_VARIANTS, BuildVariant, WHISPER_CPP_VERSION, WHISPER_MODELS, WhisperModel, detectPlatform, getConfiguredVariant, getInstallDir, getModelDir, getModelPath, getVadModelPath, getWhisperExecutablePath, getWhisperServerExecutablePath, isValidModel, resolveVariant } from './cli/config.js';
|
|
3
|
+
export { BUILD_VARIANTS, BuildVariant, WHISPER_CPP_VERSION, WHISPER_MODELS, WhisperModel, applyLegacyCpuFallback, detectPlatform, getConfiguredVariant, getInstallDir, getModelDir, getModelPath, getVadModelPath, getWhisperExecutablePath, getWhisperServerExecutablePath, isValidModel, resolveVariant } from './cli/config.js';
|
|
4
4
|
export { InstallBinaryOptions, InstallModelOptions, InstallVadModelOptions, ensureWhisperInstalled, installBinary, installModel, installVadModel } from './cli/install.js';
|
|
5
5
|
export { ConversionMode, getConfig, getConversionMode, isTimingEnabled, setConversionMode, setTimingEnabled } from './config.js';
|
|
6
6
|
export { Timeline, TimelineEntry, TimelineEntryType } from './utilities/Timeline.js';
|
package/dist/index.js
CHANGED
|
@@ -28,6 +28,7 @@ import {
|
|
|
28
28
|
BUILD_VARIANTS,
|
|
29
29
|
WHISPER_CPP_VERSION,
|
|
30
30
|
WHISPER_MODELS,
|
|
31
|
+
applyLegacyCpuFallback,
|
|
31
32
|
detectPlatform,
|
|
32
33
|
getConfiguredVariant,
|
|
33
34
|
getInstallDir,
|
|
@@ -85,6 +86,7 @@ export {
|
|
|
85
86
|
TimingAggregator,
|
|
86
87
|
WHISPER_CPP_VERSION,
|
|
87
88
|
WHISPER_MODELS,
|
|
89
|
+
applyLegacyCpuFallback,
|
|
88
90
|
audioSourceFromBuffer,
|
|
89
91
|
audioSourceFromFile,
|
|
90
92
|
audioSourceFromStream,
|