我正在使用tensorflow js从keras加载模型,如下This Guideline 然而在这行代码
const model = await tf.loadModel('https://foo.bar/tfjs_artifacts/model.json');
我收到错误
Error: Sequential.fromConfig called without an array of configs
at new t (app.js:26972)
at t.fromConfig (app.js:26972)
at deserializeKerasObject (app.js:26972)
at deserialize (app.js:26972)
at app.js:26972
at app.js:26972
at Object.next (app.js:26972)
at o (app.js:26972)
我可以做什么来修复它。导致此错误的可能原因是什么? 感谢您的帮助。
注意:我在我的服务器中启用了 cors,所以我认为这不是与 我的服务器。我使用的是本地主机(不是指南中提到的) 正如我使用过的文档中提到的
tfjs.keras.converters.save_keras_model()
最佳答案
根据https://github.com/tensorflow/tfjs/issues/744中的评论,更新您的 tfjs 版本:
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@0.13.5"></script>
这对我有用。
关于javascript - 错误 "Sequential.fromConfig called without an array of configs ",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52566747/