const tf = require('@tensorflow/tfjs');
const model = tf.sequential();
const saveResult = model.save('file:/naive_bayes.pkl');
我想导入一个模型tp TensorflowJs,它是我用Python训练的。但是我得到了这个错误:
(node:12312) UnhandledPromiseRejectionWarning: Error: Cannot find any save handlers for URL 'file:/naive_bayes.pkl'我不明白,我是在遵循它的文档。https://www.tensorflow.org/js/guide/save_load?hl=vi
我将所有文件(model、js)放在同一个文件夹中。
发布于 2020-08-24 23:16:17
像这样使用
const modelDir = 'model' // model floder in same dir
const modelPath = `file://${modelDir}`;
model.save(modelPath);或简称为
const modelDir = 'model'
model.save(`file://${modelDir}`);https://stackoverflow.com/questions/63510441
复制相似问题