Skip to content

"Can't create a session.failded to allocate a buffer of size 23200850" #1319

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
1 of 5 tasks
rockmany2000 opened this issue May 20, 2025 · 2 comments
Open
1 of 5 tasks
Labels
bug Something isn't working

Comments

@rockmany2000
Copy link

System Info

Transformer.js 3.5.1 , Chrome in Android Phone

Environment/Platform

  • Website/web-app
  • Browser extension
  • Server-side (e.g., Node.js, Deno, Bun)
  • Desktop app (e.g., Electron)
  • Other (e.g., VSCode extension)

Description

Transformer.js 3.5.1 , after "transcriber = await pipeline('automatic-speech-recognition', 'Xenova/whisper-base');"

  1. Chrome 132.0.6834.165 , realme Q3, 6G+128G. it will fail with "Can't create a session.failded to allocate a buffer of size 23200850"
  2. Chrome 132.0.6834.123 , Samsung S20+ ,8G+64G, it works ok.
  3. Chrome 136.0.7103.87 , PH-1 , 3G+128G, it works ok.
    I make a memory tester - for 1, It only allocate about 300-500MB. for 2,3 ,it can allocate about 4GB.
    function testMaxMemory() {
    let pages =100; // 62.5MB
    try {
    while (true) {
    const memory = new WebAssembly.Memory({ initial: pages, maximum: pages });
    console.log( ${pages * 65536 / (1024 * 1024)} MB);
    pages += 100;
    }
    } catch (e) {
    console.error( ${e.message});
    console.log( ${(pages - 100) * 65536 / (1024 * 1024)} MB);
    }
    }
    After searching online, I believe that this problem is related to the memory allocation of Android to WASM, but there is currently a lack of a solution, which makes it impossible to reliably deploy Transformers.js on mobile phones.

WebAssembly/design#1397

Reproduction

transcriber = await pipeline('automatic-speech-recognition', 'Xenova/whisper-base');

@rockmany2000 rockmany2000 added the bug Something isn't working label May 20, 2025
@xenova
Copy link
Collaborator

xenova commented May 27, 2025

Hi there 👋 A buffer size of 23200850 bytes is pretty small (~23 MB), but this seems to be an issue specific to Android.

Can you try with https://huggingface.co/onnx-community/whisper-base? That version should be able to reduce memory footprint slightly.

@SignOfZeta
Copy link

Hi there 👋 A buffer size of 23200850 bytes is pretty small (~23 MB), but this seems to be an issue specific to Android.

Can you try with https://huggingface.co/onnx-community/whisper-base? That version should be able to reduce memory footprint slightly.

I have faced a similar issue. I tried loading tiny and base on an android device with 8GB LPDDR4X, both loads but goes OOM pretty quick after a few seconds of transcription.

@rockmany2000 Latest stable Chrome and chromium-based Samsung Internet Browser from Play Store only allocates at most 1026MB for me. How did you get to 4GB? Are you using a modified build of chromium?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants