tf.io.loadWeights doesn't work with local file in nodejs
See original GitHub issueTo get help from the community, check out our Google group.
TensorFlow.js version
tfjs 0.11.7 tfjs-node 0.1.7
Browser version
node v8.7.0
Describe the problem or feature request
Got the following error when trying to load local weights file:
(node:73865) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): ReferenceError: fetch is not defined
Code to reproduce the bug / link to feature request
const fs = require('fs');
const tf = require('@tensorflow/tfjs');
require('@tensorflow/tfjs-node');
(async function(){
let manifest = JSON.parse(fs.readFileSync('weights.json'));
let weights = await tf.io.loadWeights(manifest, 'file://./weights');
})();
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (2 by maintainers)
Top Results From Across the Web
Save and load models | TensorFlow.js
Saving a model in node.js does not prevent it from being loaded in the browser. Below we will examine the different schemes available....
Read more >Load Tensorflow js model from local file system in javascript
I know you're trying to load your model in a browser but if anybody lands here that's trying to do it in Node,...
Read more >tensorflow/tfjs-converter v3.20.0 - npm.io
Convert a TF-Hub model file to TensorFlow.js graph model format. Use tf.loadGraphModel() to load the converted model in JavaScript. tf_saved_model ...
Read more >tfjs-converter - GitHub Pages
js can access the local file system directly. Therefore, you can load the same frozen model from local file system into a Node.js...
Read more >Tensorflow.js tf.loadLayersModel() Function - GeeksforGeeks
Tensorflow.js is a Google-developed open-source toolkit for ... and utilize them directly in the browser or with Node.js. ... A tf.io.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This is now fixed in the latest release (0.2.1) of @tensorflow/tfjs-node and @tensorflow/tfjs-node-gpu
@caisq The model was trained somewhere else, so far I only have access to the weights.