Skip to main content

downloadWhisperModel()v4.0.115

将 Whisper.cpp 模型下载到文件夹中。
您应该首先安装 Whisper.cpp,例如通过 installWhisperCpp()

install-whisper.mjs
tsx
import path from "path";
import { downloadWhisperModel } from "@remotion/install-whisper-cpp";
 
const { alreadyExisted } = await downloadWhisperModel({
model: "medium.en",
folder: path.join(process.cwd(), "whisper.cpp"),
});
install-whisper.mjs
tsx
import path from "path";
import { downloadWhisperModel } from "@remotion/install-whisper-cpp";
 
const { alreadyExisted } = await downloadWhisperModel({
model: "medium.en",
folder: path.join(process.cwd(), "whisper.cpp"),
});

选项

folder

要将模型下载到的文件夹。该模型将以 ggml-${model}.bin 文件名下载到此文件夹中。

model

要下载的模型。可能的值:tinytiny.enbasebase.ensmallsmall.enmediummedium.enlarge-v1large-v2large-v3

onProgress?

根据下载进度执行操作。这是函数签名:

tsx
import type { OnProgress } from "@remotion/install-whisper-cpp";
 
const onProgress: OnProgress = (
downloadedBytes: number,
totalBytes: number,
) => {
const progress = downloadedBytes / totalBytes;
};
tsx
import type { OnProgress } from "@remotion/install-whisper-cpp";
 
const onProgress: OnProgress = (
downloadedBytes: number,
totalBytes: number,
) => {
const progress = downloadedBytes / totalBytes;
};

printOutput?

将人类可读的进度打印到控制台。默认值:true

signal?v4.0.156

来自 AbortController 的信号,用于取消下载过程。

返回值

返回具有以下属性的对象:

alreadyExisted

指示输出路径处是否已存在文件。如果存在,则函数不执行任何操作,并将此属性设置为 true

参见