BeTomorrow / ReImproveJS

A framework using TensorFlow.js for Deep Reinforcement Learning
MIT License
123 stars 16 forks source link

saving the model #14

Open chadmcgrath opened 5 years ago

chadmcgrath commented 5 years ago

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

DevSide commented 5 years ago
model = await Model.loadFromFile('indexeddb://my-model')
// ...
await model.export('my-model', 'indexeddb')
Baael commented 5 years ago

if in nodejs you need to hack

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

//...
await model.model.save(new NodeFileSystem('./model))
//...
360disrupt commented 4 years ago

@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'})
NullVoxPopuli commented 4 years ago

how do you do this for the browser?

I'm getting this: image

image