microsoft / onnxruntime

ONNX Runtime: cross-platform, high performance ML inferencing and training accelerator
https://onnxruntime.ai
MIT License
14.62k stars 2.92k forks source link

[Web] Running onnxruntime in an audio worklet #13072

Open ricky0123 opened 2 years ago

ricky0123 commented 2 years ago

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

fs-eire commented 2 years ago

marked as 'feature request'