radi-cho / tfjs-node-save

Save the Tensorflow.js models to the filesystem of ANY Node environment

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

tfjs-node-save

The official way to save models in a Node environment is tfjs-node.
It also enhances the performance, registrers backend and allows us to use GPUs.

But tfjs-node is not supported on all operating systems, node versions, etc.
Here comes tfjs-node-save - It allows you to use the native filesystem features of tfjs-node, but excludes everything else, so it is supported in any Node environment.

In order tfjs-node-save to work efficiently you should use Node v.8 or higher.**

Usage

const tf = rquire("@tensorflow/tfjs");
require("tfjs-node-save");
model.save("file://PATH");

Refer to the official documentation on how to use the filesystem saving features.

The file:// URL scheme can be used for model saving and loading. For model saving, the scheme is followed by the path to the directory in which the model artifacts are to be saved, for example:

model.save("file://C:/tmp/").then(function() {
  console.log("Successfully saved the artifacts.");
});

Related content

About

Save the Tensorflow.js models to the filesystem of ANY Node environment

License:Apache License 2.0


Languages

Language:TypeScript 100.0%