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] [Webnn] Can't seem to use the WebNN. Getting "WEBNN execution provider is not supported in this build." #21119

Closed
RafayAK opened this issue Jun 20, 2024 · 2 comments
Labels
ep:WebNN WebNN execution provider platform:web issues related to ONNX Runtime web; typically submitted using template

Comments

@RafayAK
Copy link

RafayAK commented Jun 20, 2024

Describe the issue

Hi, when providing webnn as one of the executors I get this error:

error: Can't append execution provider: WEBNN. ERROR_CODE: 2, ERROR_MESSAGE: WEBNN execution provider is not supported in this build. 
    at t.checkLastError (ort.min.js:9:306896)
    at eval (ort.min.js:9:296280)
    at t.setSessionOptions (ort.min.js:9:296325)
    at t.createSessionFinalize (ort.min.js:9:299274)
    at t.createSessionFinalize (ort.min.js:9:290097)
    at t.OnnxruntimeWebAssemblySessionHandler.loadModel (ort.min.js:9:292999)
    at async Object.createSessionHandler (ort.min.js:9:1034)
    at async i.create (ort.min.js:9:538248)

There is very little documentation around webnn use in the Onnxweb-runtime documentation (https://onnxruntime.ai/docs/tutorials/web/env-flags-and-session-options.html#executionproviders).
I really appreciate the help 👍

To reproduce

import { InferenceSession, Tensor, env } from "onnxruntime-web";
const options = {
    executionProviders: ["webnn"], // Use WebNN for inference
};

const session = await InferenceSession.create(MODEL_URL, options);

Urgency

No response

ONNX Runtime Installation

Released Package

ONNX Runtime Version or Commit ID

1.16.1

Execution Provider

Other / Unknown

@RafayAK RafayAK added the platform:web issues related to ONNX Runtime web; typically submitted using template label Jun 20, 2024
@RafayAK
Copy link
Author

RafayAK commented Jun 20, 2024

I updated the onnx-web runtime package to the latest [email protected] still can't get it to work (code is same as above)

 Failed to load model: Error: no available backend found. ERR: [webnn] backend not found.
    at Dn (ort.min.js:20:1787)
    at async a.create (ort.min.js:20:18248)

@sophies927 sophies927 added the ep:WebNN WebNN execution provider label Jun 20, 2024
@guschmue
Copy link
Contributor

ort.min does not include webgpu or webnn EP.
Use
import { InferenceSession, Tensor, env } from 'onnxruntime-web/webgpu';

@RafayAK RafayAK closed this as completed Jun 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ep:WebNN WebNN execution provider platform:web issues related to ONNX Runtime web; typically submitted using template
Projects
None yet
Development

No branches or pull requests

3 participants