downloadWhisperModel()v4.0.115
将 Whisper.cpp 模型下载到一个文件夹中。
你应该先安装 Whisper.cpp,例如通过 installWhisperCpp() 来安装。
🌐 Downloads a Whisper.cpp model to a folder.
You should first install Whisper.cpp, for example through installWhisperCpp().
install-whisper.mjsimportpath from 'path'; import {downloadWhisperModel } from '@remotion/install-whisper-cpp'; const {alreadyExisted } = awaitdownloadWhisperModel ({model : 'medium.en',folder :path .join (process .cwd (), 'whisper.cpp'), });
选项
🌐 Options
folder
下载模型的文件夹。模型将以文件名 ggml-${model}.bin 下载到此文件夹中。
🌐 The folder to download the model to. The model will be downloaded into this folder with the filename ggml-${model}.bin.
model
要下载的模型。可能的值:tiny、tiny.en、base、base.en、small、small.en、medium、medium.en、large-v1、large-v2、large-v3、large-v3-turbo。
🌐 The model to download. Possible values: tiny, tiny.en, base, base.en, small, small.en, medium, medium.en, large-v1, large-v2, large-v3, large-v3-turbo.
onProgress?
根据下载进度采取行动。以下是函数签名:
🌐 Act upon download progress. This is the function signature:
import type {OnProgress } from '@remotion/install-whisper-cpp';
const onProgress : OnProgress = (downloadedBytes : number, totalBytes : number) => {
const progress = downloadedBytes / totalBytes ;
};printOutput?
将人类可读的进度打印到控制台。默认值:true。
🌐 Print human-readable progress to the console. Default: true.
signal?v4.0.156
来自 AbortController 的信号,用于取消下载过程。
🌐 A signal from an AbortController to cancel the download process.
返回值
🌐 Return Value
返回一个具有以下属性的对象:
🌐 Returns an object with the following property:
alreadyExisted
指示输出路径上的文件是否已存在。如果已存在,该函数不会执行任何操作,并且此属性将设置为 true。
🌐 Indicates whether a file at the output path already existed. If it did, the function did not do anything and this property is set to true.
另请参阅
🌐 See also