onnxruntime/js/node
Changming Sun 7af39c6955
Update nodejs's cmake file to fix a file copy issue (#21390)
This commit e5f18ba2c1 caused some nightly
pipelines to fail. This PR fixes it.
It is because recently I changed our Linux library's SONAME. At runtime
onnxruntime_binding depends on libonnxruntime.so.1 , instead of
libonnxruntime.so.1.19.0(with the full version number). Therefore we
need to keep the libonnxruntime.so.1 symlink.

The packaging tools/ci_build/github/js/pack-npm-packages.ps1 still needs
be updated. I will address it in another PR.
2024-07-23 11:03:55 -07:00
..
lib Bump up version in main from 1.18.0 to 1.19.0 (#20489) 2024-04-29 20:21:41 -07:00
script Enable QNN HTP support for Node (#20576) 2024-05-09 13:11:07 -07:00
src Enable QNN HTP support for Node (#20576) 2024-05-09 13:11:07 -07:00
test [js] update a few packages (#18499) 2023-11-17 22:40:51 -08:00
.gitignore [Node.js binding] Allow installation to download CUDA binaries via script (#20364) 2024-04-18 13:44:42 -07:00
.npmignore [Node.js binding] Allow installation to download CUDA binaries via script (#20364) 2024-04-18 13:44:42 -07:00
CMakeLists.txt Update nodejs's cmake file to fix a file copy issue (#21390) 2024-07-23 11:03:55 -07:00
package-lock.json Bump up version in main from 1.18.0 to 1.19.0 (#20489) 2024-04-29 20:21:41 -07:00
package.json Bump up version in main from 1.18.0 to 1.19.0 (#20489) 2024-04-29 20:21:41 -07:00
README.md [Node.js binding] Allow installation to download CUDA binaries via script (#20364) 2024-04-18 13:44:42 -07:00
tsconfig.json [js/web] fix typescript type check (#18343) 2023-11-10 16:03:38 -08:00

ONNX Runtime Node.js Binding

ONNX Runtime Node.js binding enables Node.js applications to run ONNX model inference.

Usage

Install the latest stable version:

npm install onnxruntime-node

Refer to ONNX Runtime JavaScript examples for samples and tutorials.

Requirements

ONNXRuntime works on Node.js v16.x+ (recommend v18.x+) or Electron v15.x+ (recommend v28.x+).

The following table lists the supported versions of ONNX Runtime Node.js binding provided with pre-built binaries.

EPs/Platforms Windows x64 Windows arm64 Linux x64 Linux arm64 MacOS x64 MacOS arm64
CPU ✔️ ✔️ ✔️ ✔️ ✔️ ✔️
DirectML ✔️ ✔️
CUDA ✔️[1]
  • [1]: CUDA v11.8.

To use on platforms without pre-built binaries, you can build Node.js binding from source and consume it by npm install <onnxruntime_repo_root>/js/node/. See also instructions for building ONNX Runtime Node.js binding locally.

GPU Support

Right now, the Windows version supports only the DML provider. Linux x64 can use CUDA and TensorRT.

CUDA EP Installation

To use CUDA EP, you need to install the CUDA EP binaries. By default, the CUDA EP binaries are installed automatically when you install the package. If you want to skip the installation, you can pass the --onnxruntime-node-install-cuda=skip flag to the installation command.

npm install onnxruntime-node --onnxruntime-node-install-cuda=skip

You can also use this flag to specify the version of the CUDA: (v11 or v12)

npm install onnxruntime-node --onnxruntime-node-install-cuda=v12

License

License information can be found here.