ReImproveJS icon indicating copy to clipboard operation
ReImproveJS copied to clipboard

saving the model

Open chadmcgrath opened this issue 6 years ago • 4 comments

I see a loadFromFile() method but I'm not sure how to save the model. Is there an easy way to do that?

chadmcgrath avatar Apr 24 '19 15:04 chadmcgrath

model = await Model.loadFromFile('indexeddb://my-model')
// ...
await model.export('my-model', 'indexeddb')

DevSide avatar Jun 26 '19 00:06 DevSide

if in nodejs you need to hack

import { NodeFileSystem } from "@tensorflow/tfjs-node/dist/io/file_system"

//...
await model.model.save(new NodeFileSystem('./model))
//...

Baael avatar Jul 12 '19 05:07 Baael

@Baael how do you load it, if I run it in node I get: ReferenceError: fetch is not defined

and this can be skipped if the model is loaded, right:

        // Now we initialize our model, and start adding layers
        this.model = new ReImprove.Model.FromNetwork(this.network, this.options.modelFitConfig);

        // Finally compile the model, we also exactly use tfjs's optimizers and loss functions
        // (So feel free to choose one among tfjs's)
        this.model.compile({loss: 'meanSquaredError', optimizer: 'sgd'})

360disrupt avatar Sep 25 '19 19:09 360disrupt

how do you do this for the browser?

I'm getting this: image

image

NullVoxPopuli avatar Jul 11 '20 18:07 NullVoxPopuli