簡體   English   中英

將 tensorFlow.js model(權重和偏差)加載到 web 工作人員上下文中的有效方法是什么

[英]What is an efficient way to load a tensorFlow.js model (weights & biases) into a web worker context

我正在將 tensorFlow model 加載到 vanilla JS 中的多個網絡工作者中

我嘗試使用tf.loadLayersModel("indexeddb://model_name")但它給出了“ReferenceError: window is not defined”錯誤。 我知道網絡工作者無權訪問 window object 所以這並不奇怪。 我嘗試用self覆蓋window object,但它仍然拋出錯誤。

My understanding is web-workers can access the indexed DB and a few post on git hub https://github.com/tensorflow/tfjs/issues/2643 and https://github.com/tensorflow/tfjs/issues/3402 lead我相信 tensorflow 確實支持網絡工作者內部的索引數據庫(至少在保存時)。 有沒有辦法做到這一點?

如果沒有,是否有一種將 model 編碼為 ArrayBuffer 或 SharedArrayBuffer 以有效地將數據上傳到 webworker 上下文的好方法?

我可以確認它適用於圖形模型 - 從 indexdb 加載 web 工作人員很好。 如果層模型失敗,我建議在 tfjs git repo 中打開一個問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM