microsoft / microsoft/onnxruntime-inference-examples
JavaScript: quick start with script tag does not work in ESM mode
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 1.7k
- Forks
- 414
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 14
Description
I'm trying to run the JavaScript examples, starting from the quick-start_onnxruntime-web-script-tag directory. This directory contains two versions:
- index.html, which runs perfectly and produces no errors.
- index_esm.html, which does not run and throws an error.
This is the error:
failed to inference ONNX model: Error: no available backend found. ERR: [wasm] RuntimeError: Aborted(LinkError: import object field 'J' is not a Function). Build with -sASSERTIONS for more info., [cpu] Error: previous call to 'initializeWebAssembly()' failed., [webnn] Error: previous call to 'initializeWebAssembly()' failed., [xnnpack] Error: previous call to 'initializeWebAssembly()' failed..
Output of index_esm.html:
Output of index.html:
Environment
The error appears in Firefox, Chrome and Safari. I'm running this on a MacBook Pro M2 Max in macOS Sonoma 14.2.1.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in js/quick-start_onnxruntime-web-script-tag/index_esm.html and compare it with index.html, then run both examples in Firefox, Chrome, or Safari to reproduce the backend error. Trace the ESM example's WebAssembly initialization and verify that it completes inference without the reported no-available-backend error, matching the working example's output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, wasm
- Domain
- machine-learning, web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100