question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

model.save() | ValueError: Cannot find any save handlers for URL

See original GitHub issue

System information

  • OS Platform and Distribution: Linux Debian 5.15.5-2kali2
  • TensorFlow.js installed from: npm
  • TensorFlow.js version: ^3.19.0
  • Node version: v16.13.1
  • NPM version: 8.1.2

Describe the current behavior I am trying to save the trained sequential model to the file system for later use. I have the same problem as the issues described in #4280 and #723. I have tried to any possible solution suggested in those posts but could not solve it. I am running an Electron application, the training code is called within the main process so it’s backed by NodeJS.

// Traning code
// ...

// Save model code
try {
    let saveResults = await model.save('file://./myModel');
    console.log(saveResults);
}catch ( e ) {
    console.log(e);
}

This is the error log

ValueError: Cannot find any save handlers for URL 'file://./myModel'
    at Sequential.save (webpack:///./node_modules/@tensorflow/tfjs-layers/dist/engine/training.js?:1561:23)

Describe the expected behavior According to Save and load models, the sequential tensorflow model files - [model].json & [model].weights.bin, should be saved in the file system.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
vladmandiccommented, Aug 16, 2022

I really hope to get tfjs-node working

i really really wouldn’t go down that path

but if you insist, check how package.json build.extraFiles works for electronjs
in short, you can use it to package node_modules/@tensorflow/tfjs-node which will include already built binary bindings for your platform. but if you need electron app built for anything but same platform as your dev system, no chance.

i’ve already suggested two much cleaner ideas

  • use indexdb as model store and transfer to and from indexdb using electron ipc to nodejs main process.
  • implement your i/o handler for tfjs so .save() and .load() methods will actually use electron ipc to your nodejs main process
0reactions
google-ml-butler[bot]commented, Sep 7, 2022

Are you satisfied with the resolution of your issue? Yes No

Read more comments on GitHub >

github_iconTop Results From Across the Web

Saving Model on Node: Cannot find any save handlers #723
Describe the problem or feature request​​ save('file:///tmp/my-model-1'); but I get the error: UnhandledPromiseRejectionWarning: Error: Cannot find any save ...
Read more >
Tensorflow.js save model using node - Stack Overflow
I had this same problem "Cannot find any save handlers for URL" when trying to use model.save(). The solution to my problem was...
Read more >
Saving model on node to filesystem - Google Groups
I'm getting an error saving my model: Cannot find any save handlers for URL 'file://model/'. Can someone give a hand?! Nikhil Thorat's profile...
Read more >
TensorFlow.js not able to save model - Reddit
When I run it I get this error: (node:2603) UnhandledPromiseRejectionWarning: Error: Cannot find any save handlers for URL 'file:///Users/ ...
Read more >
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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found