I am working on loading a tensorFlow model into a multiple web-workers in vanilla JS
I have tried using tf.loadLayersModel("indexeddb://model_name")
but it gives a "ReferenceError: window is not defined" error. I am aware that the web-worker does not have access to the window object so no big surprise there. I tried overwriting the window object with self, but it still throws the error.
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 me to believe that tensorflow does infact support the indexed DB inside of web-workers (at least when saving). Is there a way to do this?
If not, is there a good way to encode a model into a ArrayBuffer or SharedArrayBuffer to efficiently upload the data into the webworker context?