pluskid / Mocha.jl

Deep Learning framework for Julia
Other
1.29k stars 254 forks source link

Bug in LRPolicy.DecayOnValidation? #129

Closed stefanwebb closed 8 years ago

stefanwebb commented 8 years ago

I can't seem to get the decay on validation to work properly. Here are the relevant parts of my code:

method = Nesterov()

validation_performance = ValidationPerformance(mochaTestNet.net)
lr_policy = LRPolicy.DecayOnValidation(1.e-2, "accuracy-accuracy", 0.5)

params = make_solver_parameters(method, max_iter=niters, regu_coef=0.0005,
                            #lr_policy=LRPolicy.Inv(1.e-2, 1., 1.))
                            lr_policy = lr_policy,
                            #lr_policy=LRPolicy.Fixed(0.01))
                            mom_policy=MomPolicy.Fixed(0.9))
solver = Solver(method, params)

setup_coffee_lounge(solver, save_into="$(save_result_path)$(experiment_name).jld", every_n_iter=iterations_per_epoch, file_exists=:overwrite)

# show performance on test data every 1000 iterations
add_coffee_break(solver, validation_performance, every_n_iter=25)

# save snapshots every 100 iterations
add_coffee_break(solver, Snapshot(data_path), every_n_iter=100)

setup(params.lr_policy, validation_performance, solver)

solve(solver, mochaTrainNet.net)

This gives "ERROR: type dict has no field lr_policy"

pluskid commented 8 years ago

@stefanwebb Yes, this did not get updated when we refactored the Solver structure to include more solvers. I will try to fix this soon. Thanks for reporting!

sbhle commented 8 years ago

@pluskid: I get a similar error if i try to run the cifar10 example:

ERROR: type Staged has no field base_lr
 in get_learning_rate at /home/basti/.julia/v0.3/Mocha/src/solvers/policies.jl:106
 in solver_state at /home/basti/.julia/v0.3/Mocha/src/solvers/sgd.jl:46
 in solve at /home/basti/.julia/v0.3/Mocha/src/solvers.jl:177
 in include at ./boot.jl:245
 in include_from_node1 at loading.jl:128
 in process_options at ./client.jl:285
 in _start at ./client.jl:354

Maybe this has also to do with the refactored Solver structure?

pluskid commented 8 years ago

@stefanwebb This issue is now fixed in the latest commit.

@sbhle Yes, basically the same issue. This is also fixed now.

sbhle commented 8 years ago

Workes fine! Thank you for the fast support.