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.

How to save models with wasm backend

See original GitHub issue

With file://, it reports:

Cannot find any save handlers for URL

With io.http, it reports:

ReferenceError: FormData is not defined

Could anyone help take a look? Thanks.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
mattsoulanillecommented, Oct 7, 2021

@ydp, When tfjs-node is imported / required, it registers the file:// io handler which is used for saving models. The easiest way to register the file handler while using the wasm backend would be to import tfjs-node and then set the backend to wasm. If you don’t want to import all of tfjs-node, you can import and register just the file:// io handler, but I’m not sure this is supported. I hope this helps, and let me know if you run into any problems.

const {nodeFileSystemRouter} = require('@tensorflow/tfjs-node/dist/io/file_system');

tf.io.registerLoadRouter(nodeFileSystemRouter);
tf.io.registerSaveRouter(nodeFileSystemRouter);
0reactions
ydpcommented, Oct 7, 2021

Thank you @mattsoulanille , it works like a charm!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to convert custom Yolov5n Model to Wasm Format #6382
Hi Team, Can you please let me know how can i convert custom yolov5n (https://github.com/ultralytics/yolov5) model to wasm format to use in ...
Read more >
Adding TensorFlow.js WASM Backend in Create React App
js has a semi-functional WASM backend for running models in the browser, and you can add it as an option to your TensorFlow...
Read more >
Platform and environment | TensorFlow.js
TensorFlow.js provides a WebAssembly backend ( wasm ), which offers CPU acceleration and can be used as an alternative to the vanilla ...
Read more >
Stop training more models, start deploying them (using ...
Stop training more models, start deploying them (using WebAssembly). We are hardly living up to the promises of AI in healthcare. It's not ......
Read more >
A practical guide on using TensorFlow.js models in offline ...
npm i --save @tensorflow/tfjs-backend-wasm. Step 3: Download the model weights from TensorFlow Hub. For this step, you first need to pick which variant...
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