transformers.js-examples icon indicating copy to clipboard operation
transformers.js-examples copied to clipboard

fix(models): use runtime device detection instead of hardcoded webgpu

Open insertmike opened this issue 4 months ago • 0 comments

Abstract

Removes hardcoded device: "webgpu" from model configs to let transformers.js automatically choose the optimal device at runtime. This avoids hard-failure on non-WebGPU environments, where gpu is explicitly set for running inference.

This maintains optimal performance on supported devices while ensuring the example works everywhere.

Before

Hard failure on non-WebGPU environments with "Unsupported device: webgpu

After

Auto-selects WebGPU when available, gracefully falls back to WASM

insertmike avatar Sep 12 '25 19:09 insertmike