minpy icon indicating copy to clipboard operation
minpy copied to clipboard

[Help]How can we resume from an already saved parameters ?

Open rai16 opened this issue 8 years ago • 1 comments

rai16 avatar Apr 24 '17 17:04 rai16

@rai16 The parameters are initialized by solver.init() like https://github.com/dmlc/minpy/blob/master/examples/nn/cnn.py#L94.

So, to use the saved parameters, one solution is to replace the parameters after the parameter is initialized and before the training starts. Say, I want to replace w1 by the saved parameter w1_saved, I could insert solver.model.params['w1']=w1_saved between solver.init() and solver.tain().

The code with replacement looks like:

    # Initialize model parameters.
    solver.init()
    # Use saved parameter
    solver.model.params['w1'] = w1_saved
    # Train!
    solver.train()

Taco-W avatar May 25 '17 18:05 Taco-W