diff options
-rw-r--r-- | examples/asr_trainer.lua | 14 | ||||
m--------- | speech | 0 |
2 files changed, 8 insertions, 6 deletions
diff --git a/examples/asr_trainer.lua b/examples/asr_trainer.lua index b43a547..d72b763 100644 --- a/examples/asr_trainer.lua +++ b/examples/asr_trainer.lua @@ -4,7 +4,7 @@ function build_trainer(ifname) local layer_repo = make_layer_repo(sublayer_repo, param_repo) local crit = get_criterion_layer(sublayer_repo) local network = get_network(layer_repo) - local iterative_trainer = function (ofname, scp_file, bp) + local iterative_trainer = function (prefix, scp_file, bp) gconf.randomize = bp -- build buffer local buffer = make_buffer(make_reader(scp_file, layer_repo)) @@ -18,7 +18,7 @@ function build_trainer(ifname) print_stat(crit) gconf.cnt = 0 end - if gconf.cnt == 100 then break end +-- if gconf.cnt == 100 then break end input = {data.main_scp, data.phone_state} output = {} @@ -33,9 +33,10 @@ function build_trainer(ifname) collectgarbage("collect") end print_stat(crit) - if bp then + if (not bp) and prefix ~= nil then nerv.info("writing back...") - cf = nerv.ChunkFile(ofname, "w") + local accu_cv = get_accuracy(crit) + cf = nerv.ChunkFile(prefix .. "_cv" .. accu_cv .. ".nerv", "w") for i, p in ipairs(network:get_params()) do cf:write_chunk(p) end @@ -65,9 +66,10 @@ local do_halving = false nerv.info("initial cross validation: %.3f", accu_best) for i = 1, max_iter do nerv.info("iteration %d with lrate = %.6f", i, gconf.lrate) - local accu_tr = trainer(pf0 .. "_iter" .. i .. ".nerv", gconf.tr_scp, true) + local accu_tr = trainer(nil, gconf.tr_scp, true) nerv.info("[TR] training set %d: %.3f", i, accu_tr) - local accu_new = trainer(nil, gconf.cv_scp, false) + local accu_new = trainer(pf0 .. "_iter" .. i .. "_tr" .. accu_tr, + gconf.cv_scp, false) nerv.info("[CV] cross validation %d: %.3f", i, accu_new) -- TODO: revert the weights local accu_diff = accu_new - accu_best diff --git a/speech b/speech -Subproject be0e51156e1af9d619160bba1aa7c2eb2df3073 +Subproject aee0d372e6b06a217f24bea5c88962b97e0ca0e |