Skip to content

ngx-transformers API / ngx-transformers / hasWebGpu

Function: hasWebGpu()

hasWebGpu(): Promise<boolean>

Defined in: src/lib/device-detection.ts:14

Whether models can run on WebGPU here: navigator.gpu exists AND requestAdapter() hands back an adapter - it returns null on machines without a usable GPU or with WebGPU disabled, even when the API exists. Resolves false on the server. The probe runs once and is cached.

Returns

Promise<boolean>

MIT licensed. Models come from the Hugging Face Hub under their own licenses; check the one you ship.