Comments (3)
We're not planning on supporting pytorch in the immediate future, however there is a path to use the old checkpoint loader with pytorch.
The legacy loader with the pytorch weight-dumper script can be used: https://github.com/PAIR-code/deeplearnjs-legacy-loader
The legacy loader currently depends on deeplearn, so you're going to have a dependency problem for the JS (the python will still work).
Thankfully, all of the logic lives in a single file with 1 dependency (Tensor). This means you could just copy this file into your project: https://github.com/PAIR-code/deeplearnjs-legacy-loader/blob/master/src/checkpoint_loader.ts
You can swap the import of 'deeplearn' with '@tensorflow/tfjs' or '@tensorflow/tfjs-core' and it should just work.
from tfjs.
Thanks a lot for the pointer. I will try that.
from tfjs.
I had a .pth file (containing a pytorch model I presume) and using the method outlined above I was able to get the output: a long list of _weight and _bias files, as well as one manifest.json file. This is in line with what's described here. Finally calling the getAllVariables()
method of the legacy loader gets me the variables. However, I can't figure out the steps to move from this vars
variable to a usable, tensorflowjs-importable model. Is it by writing out the model manually as it's described on the linked page (I'm not the author of the model, so it's problematic), use tfjs converter in some way, or there's a different procedure?
from tfjs.
Related Issues (20)
- Error when running tfjs-automl in web worker due to old tfjs-core dependency HOT 5
- Issue while using tjfs node gpu in wsl2 HOT 6
- Getting cors error while calling faceLandmarksDetection.createDetector HOT 13
- a way to check if browser can run a model or not
- tf.fft rfft return tensor filled with 0 when given tensor with more than 150k element. HOT 8
- Hand-pose-detection react-native TypeError: Cannot read property 'prototype' of undefined HOT 4
- Bundle Size Issues HOT 6
- BlazePoseTfjsEstimationConfig - flipHorizontal do not work HOT 4
- @tensorflow/tfjs-node error on windows HOT 13
- Order of output heads from converted model keeps changing HOT 4
- Is there anything we can do about the JavaScript overhead that comes from predictions made in a loop?
- I'm running code of tensorflow/tfjs-node-gpu or tensorflow/tfjs-node after installation. I got an error. HOT 4
- Problem when installing tensorflowjs 3.18.0 HOT 5
- `tfjs-models/face-landmarks-detection`: `keypoint` `291` missing in `MEDIAPIPE_FACE_MESH_KEYPOINTS_BY_CONTOUR.lips` HOT 2
- Tensorflow model is working in python but converted tfjs model is not working HOT 7
- tidy function erase tensor before it can be used HOT 5
- `tf.einsum` appears incorrect for some cases HOT 2
- Installing tensorflow/tfjs-node fails on macOS Sonoma (14.3) on Apple Silicon ("Command failed: node-pre-gyp install --fallback-to-build HOT 11
- Tensorflow.js Converter: Usage of `save_format` when converting to graph model causes error on Keras 3 HOT 1
- [Codelab]: Making Predictions from 2D Data HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tfjs.