Skip to main content

downloadWhisperModel()v4.0.528

Downloads a Whisper model from remotion.media into the Transformers.js cache. Call loadWhisperModel() or transcribe() afterwards.

The browser uses its Cache API; Node.js uses the Transformers.js filesystem cache. A cache must be enabled.

download-model.ts
import {downloadWhisperModel} from '@remotion/whisper-webgpu'; const {alreadyDownloaded} = await downloadWhisperModel({ model: 'small.en', onProgress: ({progress}) => console.log(progress), }); console.log(alreadyDownloaded);

Options​

model​

One of the names returned by getAvailableModels().

onProgress?​

Called as files download. Default: no callback. The callback receives:

file​

The file being downloaded, or null for aggregate progress.

progress​

Aggregate progress between 0 and 1.

loadedBytes​

Bytes downloaded in this call.

totalBytes​

Estimated total model size in bytes.

signal?v4.0.528​

An AbortSignal for canceling the download. Calling abort() on its controller rejects the promise with the signal's reason and removes the incomplete file. Already downloaded files remain cached and can be reused on retry.

Return value​

alreadyDownloaded​

true if all files were already cached before this call.

Compatibility​

BrowsersServersEnvironments
Chrome
Firefox
Safari
Node.js
Bun
Serverless Functions

See also​