New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

onnxruntime-node-gpu

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

onnxruntime-node-gpu

Drop-in replacement for onnxruntime-node with DirectML and Cuda support

latest
Source
npmnpm
Version
1.14.0
Version published
Weekly downloads
64
60%
Maintainers
1
Weekly downloads
 
Created
Source

ONNX runtime for node with gpu support (DirectML/Cuda)

Info

This is an updated copy of official onnxruntime-node with DirectML and Cuda support.

Requirements

Windows

  • Works out of the box with DirectML. You can install CUDA and onnx runtime for windows with cuda provider for experiments, if you like.

Linux / WSL2

  • Install CUDA (tested only on 11-7 but 12 should be supported) https://docs.nvidia.com/cuda/cuda-installation-guide-linux/
  • Install onnxruntime-linux-x64-gpu-1.14.1 https://github.com/microsoft/onnxruntime/releases/tag/v1.14.1

Limitations

  • Currently, all results are returned as NAPI nodejs objects, so when you run inference multiple times (e.g. sampling on StableDiffusion Unet), there are a lot of unnecessary memory copy operations input from js to gpu and back. However, performance impact is not big. Maybe later I will make output in Tensorflow.js compatible tensors

Building manually

Just download the repo and run npx cmake-js compile

Why is onnxruntime statically linked on Windows?

For some reason, dynamically linked onnx runtime tries to load outdated DirectML.dll in system32, see https://github.com/royshil/obs-backgroundremoval/issues/272

Misc

Special thanks to authors of https://github.com/royshil/obs-backgroundremoval and https://github.com/umireon/onnxruntime-static-win for CMake scripts to download pre-built onnxruntime for static linking.

Also thanks to ChatGPT for helping me to remember how to code in c++.

You can ask me questions on Twitter

FAQs

Package last updated on 30 Apr 2023

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