microsoft / microsoft/onnxruntime-inference-examples

JavaScript: quick start with script tag does not work in ESM mode

Open
#373 2 comments 0 reactions 0 assignees View on GitHub

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:

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:

Screenshot 2024-01-25 at 12 16 46 Screenshot 2024-01-25 at 12 16 55

Output of index.html:

Screenshot 2024-01-25 at 12 21 59

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

  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 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.