Garp Independent AI & technology journalism
Sunday, August 9, 2026 Sign In · Join Subscribe
Latest Antares raises $470M to build nuclear reactors for the US military

AI news, research, models, robotics, chips, startups, and infrastructure coverage.

Updated daily

Home  /  AI News  /  Experimenting with the proposed Cross-Origin Storage API in Transformers.js

AI News

Experimenting with the proposed Cross-Origin Storage API in Transformers.js

Experimenting with the proposed Cross-Origin Storage API in Transformers.js

Hugging Face experimenting with the proposed Cross-Origin Storage API in Transformers.js

As a concrete example, the following snippet shows how to set up an automatic speech recognition (ASR) pipeline. import { pipeline } from ‘https://cdn.jsdelivr.net/npm/@huggingface/transformers@4.2.0’; const asr = await pipeline( ‘automatic-speech-recognition’, ‘Xenova/whisper-tiny.en’, { device: ‘webgpu’ }, ); const result = await asr(‘jfk.wav’); console.log(result); You will notice in the source code that I specified Xenova/whisper-tiny.en as the model, which is a very decent choice for common English automatic speech recognition tasks. In fact, it’s even the default model according to the Transformers.js default model resolution, as per the linked excerpt. When you run this example in the browser, Transformers.js automatically takes care of downloading and caching the relevant model resources and Wasm files. The following screenshot shows the Chrome DevTools Cache storage section after visiting the app. When you reload the page, the resources are served from the Cache API, and the model returns results almost instantly. However, Xenova/whisper-tiny.en being a popular model (and, as mentioned before, even being the ASR default model in Transformers.js), you can well imagine that more than just one app that you visit would use it. To simulate this situation, here’s the same example app from before, but served from a different origin. When you visit this different origin app, rather than being usable almost instantly, the browser instead has to download and cache all the model resources again, even if they’re byte-by-byte the same as before. Even in this toy example, this adds up to 177 MB of duplicate download and storage, as you can examine in the Storage section of the Chrome DevTools Application panel. You can imagine that this quickly adds up. But it gets worse. Let’s add a second pipeline to the toy example: sentiment analysis. Sentiment analysis by default uses the Xenova/distilbert-base-uncased-finetuned-sst-2-english model. By not specifying the model, Transformers.js’ default model resolution automatically picks it for you.