我有使用 TensorflowJs Converter 转换的预训练 keras 模型。我正在尝试将它们加载到以下脚本中
(index.js)
const tf = require('@tensorflow/tfjs');
require('@tensorflow/tfjs-node');
global.fetch = require('node-fetch')
const model = tf.loadLayersModel(
'model/model.json');
执行时出现以下错误node index.js
(node:28543) UnhandledPromiseRejectionWarning: Error: Request for model/decoder-model/model.json failed due to error: TypeError: Only absolute URLs are supported
和
(node:28543) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3)
(node:28543) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
我也试过这个
const model = tf.loadLayersModel(
'https://storage.googleapis.com/tfjs-models/tfjs/iris_v1/model.json');
但在这里我得到
(node:28772) UnhandledPromiseRejectionWarning: Error: Found more than one (2) load handlers for URL 'https://storage.googleapis.com/tfjs-models/tfjs/iris_v1/model.json'
系统信息
节点 v10.15.3 和 TensorflowJs v1.0.1