onnxruntime icon indicating copy to clipboard operation
onnxruntime copied to clipboard

Model cannot be used because the inference status is rejected

Open orhan-akarsu opened this issue 1 year ago • 5 comments

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.

image As you can see I am using this code. This way it works correctly in the browser. But in windows applitaction : image

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)

orhan-akarsu avatar Feb 23 '24 18:02 orhan-akarsu

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 avatar Feb 24 '24 06:02 skottmckay

@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: image I don't see any inheritance.

orhan-akarsu avatar Feb 24 '24 16:02 orhan-akarsu

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 avatar Feb 24 '24 22:02 skottmckay

@skottmckay When I used InferenceSession, it was working on the web, but not in the React Windows application. Web: image Windows app : image

The codes are the same on the web and in the application because they are received from the server.

but if use InferenceSessionFactory : image

orhan-akarsu avatar Feb 25 '24 14:02 orhan-akarsu

@fs-eire might be able to help

skottmckay avatar Feb 25 '24 22:02 skottmckay

@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.

orhan-akarsu avatar Feb 26 '24 12:02 orhan-akarsu

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.

fs-eire avatar Feb 26 '24 23:02 fs-eire

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[bot] avatar Mar 28 '24 15:03 github-actions[bot]