我想创建一个用户界面来创建,保存和训练tensorflow.js模型.但是在创建模型后我无法保存模型.我甚至从tensorflow.js文档复制了这段代码,但它不起作用:
const model = tf.sequential(
{layers: [tf.layers.dense({units: 1, inputShape: [3]})]});
console.log('Prediction from original model:');
model.predict(tf.ones([1, 3])).print();
const saveResults = await model.save('localstorage://my-model-1');
const loadedModel = await tf.loadModel('localstorage://my-model-1');
console.log('Prediction from loaded model:');
loadedModel.predict(tf.ones([1, 3])).print();Run Code Online (Sandbox Code Playgroud)
我总是收到错误消息" Uncaught SyntaxError:await仅在异步函数中有效".如何修复此问题?谢谢!
是否可以使用计算机上 csv 文件的路径来训练 tensorflow.js 模型?谢谢你!