microsoft / microsoft/onnxruntime
[Feature Request] Add a real async run method to onnxruntime-node
@fs-eire is already working on this.
Since Feb 23, 2024.
- Dominant language
- C++
- Stars
- 21.9k
- Forks
- 4.2k
- Avg merge
- 4d 11h
- Merged PRs (30d)
- 184
Description
### Describe the feature request
There should really be a true async version of `run` in `onnxruntime-node`, running computationally intensive things on the event loop will stop everything else from happening while it is running, e.g. a web server from answering requests.
This can be done by wrapping `RunAsync` behind a [`Napi::Promise`](https://github.com/nodejs/node-addon-api/blob/main/doc/promises.md) and [`Napi::TypedThreadSafeFunction`](https://github.com/nodejs/node-addon-api/blob/main/doc/typed_threadsafe_function.md) to run on the onnxruntime thread pool, or [`Napi::AsyncWorker`](https://github.com/nodejs/node-addon-api/blob/main/doc/async_worker.md) for the Node.js/libuv thread pool.
See https://github.com/microsoft/onnxruntime/pull/19610
### Describe scenario use case
Don't block the event loop while running inference, which is naturally computationally intensive.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.