vvmnnnkv / libtorchjs Goto Github PK
View Code? Open in Web Editor NEWNode.js N-API wrapper for libtorch
License: Other
Node.js N-API wrapper for libtorch
License: Other
Hi there,
As discussed before, there are some compatibility issue when loading a newer version of pytorch model, so it could be great if you recompile the module binaries with the latest version of libtorch.
Thank you in advance!
node-pre-gyp WARN Using needle for node-pre-gyp https download
node-pre-gyp ERR! install error
node-pre-gyp ERR! stack Error: 404 status code downloading tarball https://libtorchjs.s3.amazonaws.com/libtorchjs/v1.0.0-alpha.4/Release/win32-x64-napi-v3.tar.gz
node-pre-gyp ERR! stack at PassThrough. (C:\Users\troop\server\node_modules\node-pre-gyp\lib\install.js:142:27)
node-pre-gyp ERR! stack at PassThrough.emit (events.js:323:22)
node-pre-gyp ERR! stack at ClientRequest. (C:\Users\troop\server\node_modules\needle\lib\needle.js:488:9)
node-pre-gyp ERR! stack at Object.onceWrapper (events.js:418:26)
node-pre-gyp ERR! stack at ClientRequest.emit (events.js:311:20)
node-pre-gyp ERR! stack at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:603:27)
node-pre-gyp ERR! stack at HTTPParser.parserOnHeadersComplete (_http_common.js:119:17)
node-pre-gyp ERR! stack at TLSSocket.socketOnData (_http_client.js:476:22)
node-pre-gyp ERR! stack at TLSSocket.emit (events.js:311:20)
node-pre-gyp ERR! stack at addChunk (_stream_readable.js:294:12)
node-pre-gyp ERR! System Windows_NT 10.0.18362
node-pre-gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\troop\server\node_modules\node-pre-gyp\bin\node-pre-gyp" "install" "--fallback-to-build=false"
node-pre-gyp ERR! cwd C:\Users\troop\server\node_modules\libtorchjs
node-pre-gyp ERR! node -v v12.16.1
node-pre-gyp ERR! node-pre-gyp -v v0.14.0
node-pre-gyp ERR! not ok
404 status code downloading tarball https://libtorchjs.s3.amazonaws.com/libtorchjs/v1.0.0-alpha.4/Release/win32-x64-napi-v3.tar.gz
npm WARN [email protected] No description
npm WARN [email protected] No repository field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: node-pre-gyp install --fallback-to-build=false
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
how can I solve and download libtorchjs??
Hi @vvmnnnkv
So as discussed before, the lib only supports float tensors and it can only converts back to JS as Uint8 array atm. It could be great to expose more types/functions and make it more generic.
In C++ I've managed to fix the issue by changing the input tensor type to 'kLong':
torch::jit::IValue input = torch::from_blob(data, shape, torch::TensorOptions().dtype(torch::kLong))
Thank you in advance and let me know if I can help in any way !
Hello! I am using your library and it is awesome. But there are new PT versions, this way lib cannot run some modern models.
Can you please make it run at least 1.8 ver?
I have tried to do it myself, but I have no idea why compilation failing all time (spend 3 days and 0 result)
Not gonna lie, this repo is hella underrated. PyTorch is an excellent machine learning framework, c++ is hella fast, and the community for production it is hella small. You can bind pytorch (c++ libtorch) with golang, rust, nodejs so I'm quite impressed with ur readme.md explanation.
I made a fork that supports MacOS locally https://github.com/jlarmstrongiv/libtorchjs
To demo the fork, be sure to:
pip install torch torchvision torchaudio
https://download.pytorch.org/libtorch/cpu/libtorch-macos-1.8.1.zip
libtorch
folder as a sibling to lib
)npm --build-from-source install
Check out the changes in the binding.gyp
and add darwin
to the os
array in the package.json
. The fork is more of an example than a PR, since Iโm not quite sure how your build process works.
Would love to add support in the official package though ๐ keep up the great work!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.