This directory contains multiple NPM projects:
This folder contains a .vscode
folder for Visual Studio Code workspace configs. Using VSCode to open this folder
will allow code-formatting and linting features on typescript and C/C++ source code inside this folder. Following files
are used for code-formatting and linting features for developers:
- .vscode/**
- package.json
- packages-lock.json
- .eslintrc.js
- .clang-format
- in
<ORT_ROOT>/js
, run:npm ci
- use VSCode to open folder
<ORT_ROOT>/js
- install VSCode extension if not installed yet:
- Clang-Format
- ESLint
To populate typescript type declarations, in each projects, run npm ci
.
language: typescript
dependency:
folder: <ORT_ROOT>/js/common
This project is designed to include all "common" code, which are pure javascript that can run in both Node.js and browsers.
Node.js v12+ (recommended v14+)
Use following command in folder <ORT_ROOT>/js/common
to install NPM packages, build typescript files and generate bundles:
npm ci
It should be able to consumed by both from projects that uses NPM packages (through a Node.js folder structure of node_modules
folder that generated by npm install onnxruntime-common
) and from a CDN service that serves a .min.js
bundle file.
Following features are included in onnxruntime-common
:
InferenceSession
interfacesTensor
/OnnxValue
interfaces, implementation and a set of utility functionsBackend
interfaces and a set of functions for backend registration
language: typescript/C++
dependency: onnxruntime-common, ONNXRuntime.dll
folder: <ORT_ROOT>/js/node
This project is designed to be used as a NPM package to enable Node.js users to consume ONNX Runtime via Node.js binding, in Node.js or any Node.js compatible environment.
Node.js v12+ (recommended v14+)
Follow instructions for building ONNX Runtime Node.js binding
Use following command in folder <ORT_ROOT>/js/node
to install NPM packages and build typescript files:
npm ci
This will download the latest pre-built ONNX Runtime binaries for the current platform.
It should be able to consumed by from projects that uses NPM packages (through a Node.js folder structure of node_modules
folder that generated by npm install onnxruntime-node
).
language: typescript
dependency: onnxruntime-common, ONNXRuntime WebAssembly
folder: <ORT_ROOT>/js/web
This project is a library for running ONNX models on browsers. It is the successor of ONNX.js.
Node.js v12+ (recommended v14+)
-
Install NPM packages
- in
/js/
, runnpm ci
. - in
/js/common/
, runnpm ci
. - in
/js/web/
, runnpm ci
.
- in
-
Follow instructions for building ONNX Runtime WebAssembly.
-
Copy files
onnxruntime_wasm.*
from build output folder to<ORT_ROOT>/js/web/lib/wasm/binding/
. -
Use following command in folder
<ORT_ROOT>/js/web
to build:npm run build
It should be able to consumed by both from projects that uses NPM packages (through a Node.js folder structure of node_modules
folder that generated by npm install onnxruntime-web
) and from a CDN service that serves a .min.js
file and one or multiple .wasm
file(s).
TBD