onnxruntime
onnxruntime copied to clipboard
Model cannot be used because the inference status is rejected
Describe the issue
I have the yolov8 nano onnx model. I want to use this model on the web. I made the necessary improvements regarding this. It works as desired on the web with React. It does not work in the Cromium-based React Windows application.
As you can see I am using this code. This way it works correctly in the browser. But in windows applitaction :
In this way, the model cannot be loaded successfully because the status is rejected. When I look at the network through the Windows application, it does not download the necessary WASM file.
Upgrading the onnxweb version used from 1.14 to 1.17 did not solve the problem. No matter what I do the problem persists.
To reproduce
Urgency
I need to deliver the project within 1 week. I'm already past the deadline.
ONNX Runtime Installation
Built from Source
ONNX Runtime Version or Commit ID
1.17.0
Execution Provider
'wasm'/'cpu' (WebAssembly CPU)
Isn't the 'create' method part of InferenceSessionFactory not InferenceSession?
https://github.com/microsoft/onnxruntime/blob/c12a20bef95df5437189687b94e7ba2f1bad1505/js/common/lib/inference-session.ts#L415-L458
@skottmckay The usage patterns are the same, but I didn't see any inheritance. When I look at the ort.min.js file using the https://sokra.github.io/source-map-visualization/ tool:
I don't see any inheritance.
Not following what you mean by the 'usage patterns' are the same. I'm not an expert on the JS API but I don't see a create
method on the InferenceSession class so your code seems wrong. i.e. the error is not that it can't load the model it's that you're calling something that doesn't exist AFAICS. Same as if you called Inference.doMagic(...)
to load the model, unless something adds a create
method to InferenceSession outside of the definition of that class (maybe that's possible in JS).
What happens if you change InferenceSession.create
to InferenceSessionFactory.create
?
https://github.com/microsoft/onnxruntime/blob/c12a20bef95df5437189687b94e7ba2f1bad1505/js/common/lib/inference-session.ts#L341-L413
@skottmckay When I used InferenceSession, it was working on the web, but not in the React Windows application.
Web:
Windows app :
The codes are the same on the web and in the application because they are received from the server.
but if use InferenceSessionFactory :
@fs-eire might be able to help
@skottmckay Error: no available backend found. ERR: [cpu] TypeError: v.dirname is not a function at Ln (backend-impl.ts:101:9) at async a.create (inference-session-impl.ts:201:21) at async Crate.__loadModels (crate2.js?v1708949341097:71:17) at async Crate.initialize (crate2.js?v1708949341097:49:7) at async mainService (workerNiz.js?v${timestamp}:25:7)
I encountered this as an error when I did not use the Promise structure.
I think the usage of Promise has no problem. I need more information (error messages or stacktrace or whatever) to know why it does not work on windows app. just knowing that a Promise is rejected does not give me enough info to understand the root cause.
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.