Skip to content

Commit

Permalink
@remotion/install-whisper-cpp: Various Whisper.cpp fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
JonnyBurger committed Jan 31, 2025
1 parent cfe4643 commit 7a09ccf
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions packages/install-whisper-cpp/src/download-whisper-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ const modelSizes: {[key in WhisperModel]: number} = {
'small.en': 487614201,
'tiny.en': 77704715,
base: 147951465,
medium: 1533774781,
medium: 1533763059,
};

export type WhisperModel = (typeof models)[number];

export const getModelPath = (folder: string, model: WhisperModel) => {
return path.join(folder, `ggml-${model}.bin`);
return path.join(path.resolve(process.cwd(), folder), `ggml-${model}.bin`);
};

export const downloadWhisperModel = async ({
Expand Down
4 changes: 2 additions & 2 deletions packages/install-whisper-cpp/src/install-whisper-cpp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ const installWhisperForUnix = async ({

export const getWhisperExecutablePath = (whisperPath: string) => {
return os.platform() === 'win32'
? path.join(whisperPath, 'main.exe')
: path.join(whisperPath, './main');
? path.join(path.resolve(process.cwd(), whisperPath), 'main.exe')
: path.join(path.resolve(process.cwd(), whisperPath), './main');
};

export const installWhisperCpp = async ({
Expand Down
2 changes: 1 addition & 1 deletion packages/install-whisper-cpp/src/transcribe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ const transcribeToTemporaryFile = async ({

const outputPath = await new Promise<string>((resolve, reject) => {
const task = spawn(executable, args, {
cwd: whisperPath,
cwd: path.resolve(process.cwd(), whisperPath),
signal: signal ?? undefined,
});
const predictedPath = `${tmpJSONPath}.json`;
Expand Down

0 comments on commit 7a09ccf

Please sign in to comment.