noticeWebEmbedderBackendIgnored function
The web counterpart of noticeEmbedderBackendIgnored, with a different rule as well as different words.
On web NO value of preferredBackend reaches an embedder â cpu
included, which the native rule rightly stays quiet about because native
embeddings do run on CPU. Here the runtime chooses: LiteRT.js asks for
WebGPU and falls back to WASM, and onnxruntime-web tries webgpu then
wasm. The native line said "Embeddings run on CPU" to a caller whose
embeddings were running on WebGPU â a backend reported that did not run.
Implementation
void noticeWebEmbedderBackendIgnored(PreferredBackend? requested) {
if (requested == null || _warned) return;
if (!kDebugMode || gemmaLogLevel == GemmaLogLevel.none) return;
_warned = true;
gemmaLog(
'âšī¸ preferredBackend ${requested.name} is not applied to embeddings on '
'web: the runtime picks the accelerator (WebGPU first, WASM as the '
'fallback). EmbeddingModel.activeBackend is null on web; with LiteRT, '
'window.getLiteRtEmbeddingAccelerator() names it after the first '
'embedding.',
);
}