问题描述
const tf = require('@tensorflow/tfjs');
const model = tf.sequential();
const saveResult = model.save('file:/naive_bayes.pkl');
我想导入由Python训练的tp TensorflowJs模型。但是我遇到了这个错误:
(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
解决方法
这样使用
HAVING
或者简单地
const modelDir = 'model' // model floder in same dir
const modelPath = `file://${modelDir}`;
model.save(modelPath);