|
4 | 4 | # onnxjs-node |
5 | 5 | **onnxjs-node** is a Node.js binding of [ONNXRuntime](https://github.com/Microsoft/onnxruntime) that works seamlessly with [ONNX.js](https://github.com/Microsoft/onnxjs). |
6 | 6 |
|
7 | | -## Installation |
8 | | -Install the latest stable version: |
9 | | -``` |
10 | | -npm install onnxjs-node |
11 | | -``` |
12 | | - |
13 | | -*NOTE: binary files will be pulled from github during the `npm install` process.* |
14 | | - |
15 | | -## Supported Platforms |
16 | | -OS |Arch |CPU/GPU |NAPI version |Node.js version | ONNXRuntime version |
17 | | ----------|-----|--------|-------------|----------------|--------------------- |
18 | | - Windows | x64 | CPU | v3 | v12.0.0+ | v1.4.0 |
19 | | - Linux | x64 | CPU | v3 | v12.0.0+ | v1.4.0 |
20 | | - macOS | x64 | CPU | v3 | v12.0.0+ | v1.4.0 |
21 | | - Windows | x64 | GPU | v3 | v12.0.0+ | v1.4.0 |
22 | | - Linux | x64 | GPU | v3 | v12.0.0+ | v1.4.0 |
23 | | - |
24 | | -## Usage |
25 | | -There are 2 options to import `onnxjs-node`. |
26 | | - - Option 1 - replace `onnxjs` by `onnxjs-node`: |
27 | | - ```js |
28 | | - //const onnx = require('onnxjs'); |
29 | | - const onnx = require('onnxjs-node'); |
30 | | - |
31 | | - // use 'onnx' |
32 | | - // ... |
33 | | - ``` |
34 | | - - Option 2 - add a single line to require `onnxjs-node`: |
35 | | - ```js |
36 | | - require('onnxjs'); |
37 | | - require('onnxjs-node'); // this line reset global variable 'onnx' |
38 | | -
|
39 | | - // use global variable 'onnx' |
40 | | - // ... |
41 | | - ``` |
42 | | - |
43 | | -After `onnxjs-node` is imported, the default inference session class of ONNX.js will be overwritten. Any existing ONNX.js code will continue to work and model will run by ONNXRuntime backend. |
44 | | - |
45 | | -## Options |
46 | | -### Enable/Disable GPU |
47 | | -Coming soon... |
48 | | -### Backend Fallback |
49 | | -After `onnxjs-node` is imported, ONNXRuntime backend will be used by default. However, it is possible to fallback to other backend by specifying the session option `backendHint`: |
50 | | -```js |
51 | | -session = new onnx.InferenceSession({backendHint: 'wasm'}); // use ONNX.js WebAssembly backend |
52 | | -``` |
53 | | - |
54 | | -## Documentation |
55 | | -- [ONNX.js Home](https://github.com/Microsoft/onnxjs) |
56 | | -- [ONNXRuntime Node.js binding](https://github.com/Microsoft/onnxruntime/nodejs) |
57 | | - |
58 | | -# License |
59 | | -Copyright (c) fs-eire. All rights reserved. |
60 | | - |
61 | | -Licensed under the [MIT](https://github.com/fs-eire/onnxjs-node/blob/master/LICENSE) License. |
| 7 | +UPDATE on 2021-06-03: This repo is archived. Please refer to official [ONNX Runtime Node.js binding](https://github.com/microsoft/onnxruntime/tree/master/js/node). |
0 commit comments