Tensorflow.js使用节点保存模型
我想使用此功能从node.js保存经过训练的模型
async function tfModelExperiment(model) {
try {
let tsModelTraining = await model.save('file:///tmp/my-model-1');
}
catch (error) {
console.log(error);
}
}
但是保存模型时会返回
(node:23756)UnhandledPromiseRejectionWarning:错误:找不到任何保存URL'file:/// tmp / my-model-1'的处理程序]
我发现另一个人正在为这个问题而苦苦挣扎,但通过添加来解决此问题>
const tf = require('@tensorflow/tfjs');
我已经拥有了,我已经尝试将目录更改为我的主目录,但这不能解决问题,也不能以sudo的身份运行它,我会怎么做?
软件
我正在将Ubuntu TensorFlow.js软件包(0.13.0)与npm一起安装的Ubuntu Ubuntu 18.04.1 LTS使用]编辑:
应注意,我尝试过
import * as tf from '@tensorflow/tfjs'; import '@tensorflow/tfjs-node';
如此处提供的(,返回
TypeError:tf.sequential不是函数在file:///home/sjors/node.mjs:7:18在ModuleJob.run(内部/加载程序/ModuleJob.js:94:14)在
我已经尝试:
const tf = require('@tensorflow/tfjs'); require('@tensorflow/tfjs-node');
与之前返回相同的
UnhandledPromiseRejectionWarning
错误
我想使用此函数从node.js保存经过训练的模型异步函数tfModelExperiment(model){试试{let tsModelTraining = await model.save('file:/// tmp / my-model-1'); } catch(...
回答如下:我现在在github上的tfjs的帮助下工作了。
基本上,您只需要安装tfjs-node依赖项:
Tensorflow.js使用节点保存模型
我想使用此功能从node.js保存经过训练的模型
async function tfModelExperiment(model) {
try {
let tsModelTraining = await model.save('file:///tmp/my-model-1');
}
catch (error) {
console.log(error);
}
}
但是保存模型时会返回
(node:23756)UnhandledPromiseRejectionWarning:错误:找不到任何保存URL'file:/// tmp / my-model-1'的处理程序]
我发现另一个人正在为这个问题而苦苦挣扎,但通过添加来解决此问题>
const tf = require('@tensorflow/tfjs');
我已经拥有了,我已经尝试将目录更改为我的主目录,但这不能解决问题,也不能以sudo的身份运行它,我会怎么做?
软件
我正在将Ubuntu TensorFlow.js软件包(0.13.0)与npm一起安装的Ubuntu Ubuntu 18.04.1 LTS使用]编辑:
应注意,我尝试过
import * as tf from '@tensorflow/tfjs'; import '@tensorflow/tfjs-node';
如此处提供的(,返回
TypeError:tf.sequential不是函数在file:///home/sjors/node.mjs:7:18在ModuleJob.run(内部/加载程序/ModuleJob.js:94:14)在
我已经尝试:
const tf = require('@tensorflow/tfjs'); require('@tensorflow/tfjs-node');
与之前返回相同的
UnhandledPromiseRejectionWarning
错误
我想使用此函数从node.js保存经过训练的模型异步函数tfModelExperiment(model){试试{let tsModelTraining = await model.save('file:/// tmp / my-model-1'); } catch(...
回答如下:我现在在github上的tfjs的帮助下工作了。
基本上,您只需要安装tfjs-node依赖项: