Skip to main content

loadWhisperModel()v4.0.518

Initializes a previously downloaded Whisper model on WebGPU. Call downloadWhisperModel() first.

transcribe() loads the model automatically; call loadWhisperModel() when you want to initialize it before transcription.

load-model.ts
import {downloadWhisperModel, loadWhisperModel} from '@remotion/whisper-webgpu'; await downloadWhisperModel({model: 'small.en'}); await using result = await loadWhisperModel({ model: 'small.en', }); console.log(result.alreadyLoaded);

Options​

model​

One of the names returned by getAvailableModels().

onProgress?​

Called while the cached model is initialized. progress is null during initialization and 1 when ready. Use downloadWhisperModel() for download progress.

signal?v4.0.528​

An AbortSignal for canceling this call.

Return value​

alreadyLoaded​

Whether the same model pipeline was already loaded in memory.

[Symbol.asyncDispose]()v4.0.528​

Releases this call's hold on the initialized model. The pipeline is disposed after every load handle is released and active transcriptions finish.

Use await using to call this method automatically when leaving the current scope. Call disposeWhisperModel() to dispose the pipeline explicitly regardless of retained load handles.

Transformers.js manages the persistent model cache. Releasing the initialized pipeline does not delete the downloaded model files.

Compatibility​

BrowsersServersEnvironments
Chrome
Firefox
Safari
Node.js
Bun
Serverless Functions

See also​