Skip to content
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

[Web] no available backend found [wasm] when importing onnxruntime-web/wasm #22010

Open
jclaessens97 opened this issue Sep 6, 2024 · 6 comments
Labels
platform:web issues related to ONNX Runtime web; typically submitted using template

Comments

@jclaessens97
Copy link

jclaessens97 commented Sep 6, 2024

Describe the issue

When importing onnxruntime-web with a general star import like import * as ort from 'onnxruntime-web';, it works like a charm. But since I only use wasm, I would expect to be able to import as import ort from 'onnxruntime-web/wasm; if I follow these docs.

I serve both ort-wasm-simd-threaded.jsep.wasm and ort-wasm-simd-threaded.wasm.

If I do so, I get following errors in the console:
image

I'm launching the inference session like this:

ort.env.wasm.wasmPaths = '/ort/';

const model = await ort.InferenceSession.create(
  SAM_ONNX_MODEL_URL,
  { executionProviders: ['wasm'] },
);

To reproduce

  1. Install onnxruntime-web
  2. import * as ort from 'onnxruntime-web';
  3. It works
  4. Change import to import ort from 'onnxruntime-web/wasm;
  5. See error in console

Urgency

No response

ONNX Runtime Installation

Released Package

ONNX Runtime Version or Commit ID

1.19.2

Execution Provider

'wasm'/'cpu' (WebAssembly CPU)

@jclaessens97 jclaessens97 added the platform:web issues related to ONNX Runtime web; typically submitted using template label Sep 6, 2024
@gyagp
Copy link

gyagp commented Sep 6, 2024

For wasm EP, you just need to import "onnxruntime-web". More details can be found at https://onnxruntime.ai/docs/get-started/with-javascript/web.html.

@fs-eire
Copy link
Contributor

fs-eire commented Sep 6, 2024

importing 'onnxruntime-web/wasm' will use a smaller sized .mjs file and it should work.

let me check the artifacts...

@fs-eire
Copy link
Contributor

fs-eire commented Sep 6, 2024

@jclaessens97 could you help to check whether the following works for you:

  • import 'onnxruntime-web' instead of 'onnxruntime-web/wasm'
  • install onnxruntime-web version 1.20.0-dev.20240902-b1ae43cbcb

@jclaessens97
Copy link
Author

The first import import * as ort from 'onnxruntime-web'; works. It's the import * as ort from 'onnxruntime-web/wasm'; import that doesn't work.

In version 1.20 it's also the same.

Copy link
Contributor

github-actions bot commented Oct 6, 2024

This issue has been automatically marked as stale due to inactivity and will be closed in 30 days if no further activity occurs. If further support is needed, please provide an update and/or more details.

@github-actions github-actions bot added the stale issues that have not been addressed in a while; categorized by a bot label Oct 6, 2024
@jclaessens97
Copy link
Author

Any update? @fs-eire This still is the case for me.

@github-actions github-actions bot removed the stale issues that have not been addressed in a while; categorized by a bot label Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform:web issues related to ONNX Runtime web; typically submitted using template
Projects
None yet
Development

No branches or pull requests

3 participants