microsoft / microsoft/onnxruntime

[Web] Running onnxruntime in an audio worklet

Open
#13,072 1 comment 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature request platform:web
Dominant language
C++
Stars
21.9k
Forks
4.2k
Avg merge
4d 8h
Merged PRs (30d)
179

Description

Describe the issue

I'm unable to start an inference session in an audio worklet context. I'm not sure what all of the obstacles to getting onnxruntime working in that context but I think the current build system may assume there is a global object called "self" that doesn't exist in that context. There are also other unusual characteristics of that context, some of which are documented here.

To reproduce

Here is a repo with my best attempt to run onnxruntime-web in an audio worklet. I end up with this error in the console

Error: no available backend found. ERR: [wasm] TypeError: o.cpus is not a function worklet.js line 19 > eval:85:11
Urgency

No response

ONNX Runtime Installation

Released Package

ONNX Runtime Version or Commit ID

"onnxruntime-web": "^1.12.1"

Execution Provider

WASM

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked onnx-audio-worklet-issue reproduction and worklet.js around line 19, using onnxruntime-web 1.12.1 with the WASM execution provider. Investigate the reported "no available backend" and "o.cpus is not a function" errors in the AudioWorklet context; done means an inference session starts successfully there.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, wasm
Domain
machine-learning, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.