javascript - 错误 "Sequential.fromConfig called without an array of configs "

标签 javascript tensorflow keras tensorflow.js tensorflowjs-converter

我正在使用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/

相关文章:

javascript - 我什至无法让 $().text 正常工作。反而输出一大串代码

javascript - 如何从父vuejs向子组件传递数据

使用 MongoDB "$in"运算符的 Javascript 查询生成器

python - 类型错误 : Expected binary or unicode string, 得到了项目 {

python - 如何使用 model.pb、model.h5 或 model.json 创建 CNN 的 .config 文件?

python - 为什么tensorflow.function(不带jit_compile)可以加速Keras模型的前向传递?

tensorflow - 如何在图层中设置自定义权重?

keras - 使用 Keras train_on_batch 时将直方图摘要添加到张量板

javascript - 如何调试失败的 Angular 选择(或任何其他类型)绑定(bind)?

python - 我如何修复此语句,我的代码不适用于 tensorflow ?