Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

onnxjs-node

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

onnxjs-node

ONNXRuntime backend for ONNX.js

  • 1.4.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
10
increased by66.67%
Maintainers
1
Weekly downloads
 
Created
Source

npm version GitHub version

onnxjs-node

onnxjs-node is a Node.js binding of ONNXRuntime that works seamlessly with ONNX.js.

Installation

Install the latest stable version:

npm install onnxjs-node

NOTE: binary files will be pulled from github during the npm install process.

Supported Platforms

OSArchCPU/GPUNAPI versionNode.js versionONNXRuntime version
Windowsx64CPUv3v12.0.0+v1.4.0
Linuxx64CPUv3v12.0.0+v1.4.0
macOSx64CPUv3v12.0.0+v1.4.0
Windowsx64GPUv3v12.0.0+v1.4.0
Linuxx64GPUv3v12.0.0+v1.4.0

Usage

There are 2 options to import onnxjs-node.

  • Option 1 - replace onnxjs by onnxjs-node:
    //const onnx = require('onnxjs');
    const onnx = require('onnxjs-node');
    
    // use 'onnx'
    // ...
    
  • Option 2 - add a single line to require onnxjs-node:
    const onnx = require('onnxjs');
    require('onnxjs-node');  // this line can be put on the top as well
    
    // use 'onnx'
    // ...
    

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.

Options

Enable/Disable GPU

Coming soon...

Backend Fallback

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:

session = new onnx.InferenceSession({backendHint: 'wasm'});  // use WebAssembly backend

Documentation

License

Copyright (c) fs-eire. All rights reserved.

Licensed under the MIT License.

Keywords

FAQs

Package last updated on 11 Aug 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc