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] Failed to load model: Error: no available backend found. ERR: [webgpu] backend not found #22885

Open
mozeqiu123 opened this issue Nov 19, 2024 · 2 comments
Labels
ep:WebGPU ort-web webgpu provider platform:web issues related to ONNX Runtime web; typically submitted using template

Comments

@mozeqiu123
Copy link

Describe the issue

I'm new to this. I want to run my OCR text recognition model on the web side. But inference is slow, so I want to use webgpu for acceleration.

To reproduce

Load ort in html file:
<script src="https://unpkg.com/onnxruntime-web/dist/ort.min.js"></script>
use and get error:
const det_path = "det.onnx" async function loadDetModle() { try{ if (!navigator.gpu) { throw new Error("WebGPU is not supported in this browser."); } const session_det = await ort.InferenceSession.create(det_path, { executionProviders: ['webgpu'] }); console.log("Model loaded successfully with WebGPU backend."); return session_det }catch (e) { console.error("Failed to load model:", e); } }
If you don’t use executionProviders: ['webgpu'] you can use it normally and reason about it.

Also, if using webgl. Then other errors will occur。What does the following error mean?
transform.js:214 Failed to load model: TypeError: cannot resolve operator 'HardSigmoid' with opsets: ai.onnx v11

Urgency

No response

ONNX Runtime Installation

Other / Unknown

ONNX Runtime Version or Commit ID

1.20.0

Execution Provider

'webgpu' (WebGPU)

@mozeqiu123 mozeqiu123 added the platform:web issues related to ONNX Runtime web; typically submitted using template label Nov 19, 2024
@github-actions github-actions bot added the ep:WebGPU ort-web webgpu provider label Nov 19, 2024
@skottmckay
Copy link
Contributor

Not clear what error you're getting when you try and use WebGPU. Is there a specific error message?

WebGL must not have implemented the HardSigmoid operator. It's unlikely that will happen as I believe WebGPU is the preferred option now.

@fs-eire
Copy link
Contributor

fs-eire commented Nov 26, 2024

you need to use <script src="https://unpkg.com/onnxruntime-web/dist/ort.webgpu.min.js"></script> to enable webgpu.

the next version of ORT will include webgpu in ort.min.js by default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ep:WebGPU ort-web webgpu provider platform:web issues related to ONNX Runtime web; typically submitted using template
Projects
None yet
Development

No branches or pull requests

3 participants