【发布时间】:2020-05-22 21:52:14
【问题描述】:
在使用 WAMP 堆栈执行以下嵌入在 html 中的代码时
const model = tf.loadLayersModel('js/model.json');
我在chrome中遇到以下错误
> Uncaught (in promise) TypeError: Failed to fetch
> platform_browser.ts:28 GET http://localhost/poemgenerator/js/group1-shard3of22.bin net::ERR_EMPTY_RESPONSE
> Uncaught (in promise) TypeError: Failed to fetch
我在提到的位置有所有 group1-shard__of22.bin
在每次运行代码期间,ERR_EMPTY_RESPONSE 会显示在不同的文件中。
使用加载的 tfjs
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@1.7.2/dist/tf.min.js"></script>
PS:
在执行代码时,IDM 开始下载所有 group1-shard__of22.bin 文件
I 正在加载的模型是在 python 中创建的,并且是一个 tf.keras 模型。已使用 tfjs 转换器进行转换
更新:
我用
替换了上面的代码async function predict(){
const model = await tf.loadLayersModel('js/model.json');
model.summary()
}
并且还删除了 IDM,但它显示了另一个错误:
> errors.ts:48 Uncaught (in promise) Error: Provided weight data has no target variable: lstm_3/lstm_cell_3/kernel
> (index):68 Uncaught TypeError: model.summary is not a function
【问题讨论】:
标签: javascript tensorflow tf.keras tensorflow.js tfjs-node