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
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 useexecutionProviders: ['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)