@remotion/install-whisper-cpp 4.0.193 → 4.0.195
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/transcribe.d.ts +1 -0
- package/dist/transcribe.js +17 -2
- package/package.json +1 -1
package/dist/transcribe.d.ts
CHANGED
|
@@ -59,6 +59,7 @@ export type TranscriptionJson<WithTokenLevelTimestamp extends boolean> = {
|
|
|
59
59
|
transcription: true extends WithTokenLevelTimestamp ? TranscriptionItemWithTimestamp[] : TranscriptionItem[];
|
|
60
60
|
};
|
|
61
61
|
export type TranscribeOnProgress = (progress: number) => void;
|
|
62
|
+
export declare const modelToDtw: (model: WhisperModel) => string;
|
|
62
63
|
export declare const transcribe: <HasTokenLevelTimestamps extends boolean>({ inputPath, whisperPath, model, modelFolder, translateToEnglish, tokenLevelTimestamps, printOutput, tokensPerItem, language, signal, onProgress, }: {
|
|
63
64
|
inputPath: string;
|
|
64
65
|
whisperPath: string;
|
package/dist/transcribe.js
CHANGED
|
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.transcribe = void 0;
|
|
29
|
+
exports.transcribe = exports.modelToDtw = void 0;
|
|
30
30
|
const node_child_process_1 = require("node:child_process");
|
|
31
31
|
const node_fs_1 = __importStar(require("node:fs"));
|
|
32
32
|
const node_path_1 = __importDefault(require("node:path"));
|
|
@@ -43,6 +43,21 @@ const readJson = async (jsonPath) => {
|
|
|
43
43
|
const data = await node_fs_1.default.promises.readFile(jsonPath, 'utf8');
|
|
44
44
|
return JSON.parse(data);
|
|
45
45
|
};
|
|
46
|
+
// https://github.com/ggerganov/whisper.cpp/blob/fe36c909715e6751277ddb020e7892c7670b61d4/examples/main/main.cpp#L989-L999
|
|
47
|
+
// https://github.com/remotion-dev/remotion/issues/4168
|
|
48
|
+
const modelToDtw = (model) => {
|
|
49
|
+
if (model === 'large-v3') {
|
|
50
|
+
return 'large.v3';
|
|
51
|
+
}
|
|
52
|
+
if (model === 'large-v2') {
|
|
53
|
+
return 'large.v2';
|
|
54
|
+
}
|
|
55
|
+
if (model === 'large-v1') {
|
|
56
|
+
return 'large.v1';
|
|
57
|
+
}
|
|
58
|
+
return model;
|
|
59
|
+
};
|
|
60
|
+
exports.modelToDtw = modelToDtw;
|
|
46
61
|
const transcribeToTemporaryFile = async ({ fileToTranscribe, whisperPath, model, tmpJSONPath, modelFolder, translate, tokenLevelTimestamps, printOutput, tokensPerItem, language, signal, onProgress, }) => {
|
|
47
62
|
const modelPath = (0, download_whisper_model_1.getModelPath)(modelFolder !== null && modelFolder !== void 0 ? modelFolder : whisperPath, model);
|
|
48
63
|
if (!node_fs_1.default.existsSync(modelPath)) {
|
|
@@ -57,7 +72,7 @@ const transcribeToTemporaryFile = async ({ fileToTranscribe, whisperPath, model,
|
|
|
57
72
|
'--output-json',
|
|
58
73
|
tokensPerItem ? ['--max-len', tokensPerItem] : null,
|
|
59
74
|
'-ojf', // Output full JSON
|
|
60
|
-
tokenLevelTimestamps ? ['--dtw', model] : null,
|
|
75
|
+
tokenLevelTimestamps ? ['--dtw', (0, exports.modelToDtw)(model)] : null,
|
|
61
76
|
model ? [`-m`, `${modelPath}`] : null,
|
|
62
77
|
['-pp'], // print progress
|
|
63
78
|
translate ? '-tr' : null,
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"url": "https://github.com/remotion-dev/remotion/tree/main/packages/install-whisper-cpp"
|
|
4
4
|
},
|
|
5
5
|
"name": "@remotion/install-whisper-cpp",
|
|
6
|
-
"version": "4.0.
|
|
6
|
+
"version": "4.0.195",
|
|
7
7
|
"description": "Helpers for installing and using Whisper.cpp",
|
|
8
8
|
"main": "dist/index.js",
|
|
9
9
|
"sideEffects": false,
|