{"record":{"id":"3d9e8c61c6f2bd0c","repo":"moeru-ai/airi","slug":"whisper-worker-webgpu-not-available-falling-bac","errorCode":null,"errorMessage":"[Whisper Worker] WebGPU not available, falling back to WASM","messagePattern":"\\[Whisper Worker\\] WebGPU not available, falling back to WASM","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/stage-ui/src/libs/workers/worker.ts","lineNumber":106,"sourceCode":"\n// Track which device was actually used (for reporting back to main thread)\nlet resolvedDevice: 'webgpu' | 'wasm' | 'cpu' = 'webgpu'\n\nclass AutomaticSpeechRecognitionPipeline {\n  static model_id: string | null = null\n  static tokenizer: Promise<PreTrainedTokenizer>\n  static processor: Promise<Processor>\n  static model: Promise<PreTrainedModel>\n\n  static async getInstance(progress_callback?: ProgressCallback, device: 'webgpu' | 'wasm' | 'cpu' = 'webgpu') {\n    this.model_id = MODEL_ID\n\n    // Auto-detect: if WebGPU was requested but unavailable, fall back to WASM\n    let actualDevice = device\n    if (device === 'webgpu') {\n      const hasWebGPU = await detectWebGPUInWorker()\n      if (!hasWebGPU) {\n        console.warn('[Whisper Worker] WebGPU not available, falling back to WASM')\n        actualDevice = 'wasm'\n      }\n    }\n    resolvedDevice = actualDevice\n\n    this.tokenizer ??= AutoTokenizer.from_pretrained(this.model_id, {\n      progress_callback,\n    })\n\n    this.processor ??= AutoProcessor.from_pretrained(this.model_id, {\n      progress_callback,\n    })\n\n    // NOTICE: fp16 encoder may fail on some devices/browsers. Fall back to fp32\n    // if the initial load fails. Decoder fp16 is known broken (see Issue #989).\n    // https://github.com/huggingface/transformers.js/issues/989\n    this.model ??= (async () => {\n      try {","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/moeru-ai/airi/blob/677329427f32468c74b17f3ec47eeca4e05bec65/packages/stage-ui/src/libs/workers/worker.ts#L88-L124","documentation":"Emitted by the Whisper transcription worker when getInstance() was asked for device 'webgpu' (the default) but detectWebGPUInWorker() found no navigator.gpu in the worker context. The worker silently downgrades: resolvedDevice becomes 'wasm' and inference proceeds on the WASM/CPU backend of transformers.js - functional but typically much slower than WebGPU.","triggerScenarios":"Any WhisperWorker.getInstance(progress_callback) call (device defaults to 'webgpu') in a browser without WebGPU: Firefox, older Chrome/Safari, WebGPU disabled via flags or driver blocklist, headless/CI contexts, or workers where navigator.gpu is not exposed.","commonSituations":"Running stage-ui in Firefox; CI screenshot jobs without GPU; VMs and remote desktops with software rendering; Chrome blocklisting old GPU drivers; machines where users expect GPU speed but only WASM is available, so transcription feels slow.","solutions":["Check WebGPU support in the same browser profile (chrome://gpu, or 'gpu' in navigator on the main thread)","Update the browser or enable WebGPU flags if the hardware actually supports it","Accept the WASM fallback but pick a smaller/quantized whisper model to keep latency acceptable","Pass device: 'wasm' explicitly to skip the probe and the warning when GPU absence is known","In CI/VM environments, pin device 'wasm' so startup is deterministic"],"exampleFix":"// before\nWhisperWorker.getInstance(progressCallback) // device defaults to 'webgpu', warns + falls back\n\n// after\nconst device = 'gpu' in navigator ? 'webgpu' : 'wasm'\nWhisperWorker.getInstance(progressCallback, device)","handlingStrategy":"fallback","validationCode":"const device: 'webgpu' | 'wasm' = 'gpu' in navigator ? 'webgpu' : 'wasm'\nawait WhisperWorker.getInstance(progressCallback, device)","typeGuard":null,"tryCatchPattern":"try {\n  await loadModel({ device: 'webgpu' })\n}\ncatch {\n  await loadModel({ device: 'wasm' })\n}","preventionTips":["Probe navigator.gpu on the main thread and pass the device explicitly","Keep quantized model variants available for WASM-only users","Treat slow inference on WASM as expected, not a regression"],"tags":["webgpu","wasm","transformers-js","whisper","device-fallback"],"backgroundTag":"webgpu-not-available","analyzedSha":"677329427f32468c74b17f3ec47eeca4e05bec65","analyzedAt":"2026-08-18T17:29:58.153Z","schemaVersion":2},"datasetVersion":"2026-08-23T13:39:53.451Z"}