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.tsimport {downloadWhisperModel ,loadWhisperModel } from '@remotion/whisper-webgpu'; awaitdownloadWhisperModel ({model : 'small.en'}); await usingresult = awaitloadWhisperModel ({model : 'small.en', });console .log (result .alreadyLoaded );
Options
model
One of the names returned by getAvailableModels().
onProgress?
Called while the cached model is initialized. Use downloadWhisperModel() for download progress.
The callback receives an object with the following properties:
status
'initializing' while the model is initialized, 'ready' when it is ready.
file
Always null.
progress
null during initialization, 1 when ready.
loadedBytes
Always null.
totalBytes
Always null.
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
| Browsers | Servers | Environments | |||||||
|---|---|---|---|---|---|---|---|---|---|
Chrome | Firefox | Safari | Node.js | Bun | Serverless Functions | ||||