【问题标题】:Tensorflowjs Save Model throws Error: Unsupported TypedArray subtype: Float32ArrayTensorflowjs 保存模型抛出错误:不支持的 TypedArray 子类型:Float32Array
【发布时间】:2019-08-11 19:32:17
【问题描述】:

我有一个在我的 Mac 上本地运行的 tensorflowjs (1.2.7) 概念证明。一切正常,我可以创建一个模型并做出预测,但是当我尝试保存时。我收到以下错误。

 Unsupported TypedArray subtype: Float32Array

      at node_modules/@tensorflow/tfjs-core/src/io/io_utils.ts:207:13
          at Array.forEach (<anonymous>)
      at concatenateTypedArrays (node_modules/@tensorflow/tfjs-core/src/io/io_utils.ts:199:6)
      at Object.<anonymous> (node_modules/@tensorflow/tfjs-core/src/io/io_utils.ts:93:17)
      at step (node_modules/@tensorflow/tfjs-core/dist/io/io_utils.js:48:23)
      at Object.next (node_modules/@tensorflow/tfjs-core/dist/io/io_utils.js:29:53)
      at fulfilled (node_modules/@tensorflow/tfjs-core/dist/io/io_utils.js:20:58)

这似乎只在我保存时发生。任何帮助将非常感激。

model.save('file:///path/to/my-model');

我正在使用特定于节点的版本“@tensorflow/tfjs-node”。 https://www.tensorflow.org/js/guide/save_load#native_file_system_nodejs_only

我不愿意采取这种方法(TensorFlow.js: Saving different model instances during training),听起来你输了 这样模型的各个方面。

【问题讨论】:

  • Float32Array 是supported。你能展示更多你的代码吗?您是否正在使用任何其他包装库?您是如何加载数字的?
  • 感谢您在我脑海中植入这个想法。我通过 Jest 运行这段代码(作为单元测试)。当我通过开玩笑运行时,它每次都会失败。当我重构测试运行器以使用 vanilla JS 时,它工作得很好。
  • 很高兴我能帮上忙。如果您同意的话,我也可以将其添加为未来访问者的更详细的答案。
  • 这是 Jest 特有的吗?是否值得设置使用另一个库,例如 Ava 进行测试?我确实有这个问题,想知道要花多少时间来考虑其他选择。

标签: node.js tensorflow.js


【解决方案1】:

这与在 Jest 单元测试中运行有关。否则这不是问题。

【讨论】:

  • erg 我正好遇到了这个问题。所以我们不能用玩笑来测试它呃...... :(
猜你喜欢
  • 2019-03-05
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-12-23
  • 1970-01-01
  • 1970-01-01
  • 2019-02-25
  • 1970-01-01
相关资源
最近更新 更多