From a753eca0121ac3ec81ed76bd719d3f1cb9522680 Mon Sep 17 00:00:00 2001 From: Determinant Date: Wed, 3 Jun 2015 23:00:30 +0800 Subject: ... --- examples/tnet_preprocessing_example.lua | 2 +- examples/tnet_preprocessing_example2.lua | 2 +- examples/tnet_sgd_buffer.lua | 70 ++++++++++++++++++++++++++++++++ 3 files changed, 72 insertions(+), 2 deletions(-) create mode 100644 examples/tnet_sgd_buffer.lua (limited to 'examples') diff --git a/examples/tnet_preprocessing_example.lua b/examples/tnet_preprocessing_example.lua index 8a65b44..5f20910 100644 --- a/examples/tnet_preprocessing_example.lua +++ b/examples/tnet_preprocessing_example.lua @@ -1,6 +1,6 @@ require 'libspeech' frm_ext = 5 -gconf = {mat_type = nerv.CuMatrixFloat, +gconf = {cumat_type = nerv.CuMatrixFloat, batch_size = 158} param_repo = nerv.ParamRepo({"global_transf.nerv"}) sublayer_repo = nerv.LayerRepo( diff --git a/examples/tnet_preprocessing_example2.lua b/examples/tnet_preprocessing_example2.lua index ae8d86b..8e1bc85 100644 --- a/examples/tnet_preprocessing_example2.lua +++ b/examples/tnet_preprocessing_example2.lua @@ -1,5 +1,5 @@ require 'speech.init' -gconf = {mat_type = nerv.CuMatrixFloat, +gconf = {cumat_type = nerv.CuMatrixFloat, batch_size = 158} param_repo = nerv.ParamRepo({"global_transf.nerv"}) diff --git a/examples/tnet_sgd_buffer.lua b/examples/tnet_sgd_buffer.lua new file mode 100644 index 0000000..152d2f5 --- /dev/null +++ b/examples/tnet_sgd_buffer.lua @@ -0,0 +1,70 @@ +require 'speech.init' +gconf = {cumat_type = nerv.CuMatrixFloat, + mmat_type = nerv.MMatrixFloat, + batch_size = 256} +param_repo = nerv.ParamRepo({"global_transf.nerv"}) + +sublayer_repo = nerv.LayerRepo( + { + ["nerv.BiasLayer"] = + { + blayer1 = {{bias = "bias1"}, {dim_in = {429}, dim_out = {429}}}, + blayer2 = {{bias = "bias2"}, {dim_in = {429}, dim_out = {429}}} + }, + ["nerv.WindowLayer"] = + { + wlayer1 = {{window = "window1"}, {dim_in = {429}, dim_out = {429}}}, + wlayer2 = {{window = "window2"}, {dim_in = {429}, dim_out = {429}}} + } + }, param_repo, gconf) + +layer_repo = nerv.LayerRepo( + { + ["nerv.DAGLayer"] = + { + main = {{}, { + dim_in = {429}, dim_out = {429}, + sub_layers = sublayer_repo, + connections = { + ["[1]"] = "blayer1[1]", + ["blayer1[1]"] = "wlayer1[1]", + ["wlayer1[1]"] = "blayer2[1]", + ["blayer2[1]"] = "wlayer2[1]", + ["wlayer2[1]"] = "[1]" + } + }} + } + }, param_repo, gconf) + +tnet_reader = nerv.TNetReader({}, + { + id = "main_scp", +-- scp_file = "/slfs1/users/mfy43/swb_ivec/train_bp.scp", + scp_file = "t.scp", + conf_file = "/slfs1/users/mfy43/swb_ivec/plp_0_d_a.conf", + frm_ext = 5, + mlfs = { + ref = { + file = "/slfs1/users/mfy43/swb_ivec/ref.mlf", + format = "map", + format_arg = "/slfs1/users/mfy43/swb_ivec/dict", + dir = "*/", + ext = "lab" + } + }, + global_transf = layer_repo:get_layer("main") + }) + +buffer = nerv.SGDBuffer(gconf, + { + buffer_size = 1024, + readers = { + { reader = tnet_reader, + data = {main_scp = 429, ref = 1}} + } + }) + +for data in buffer.get_data, buffer do + print(data.main_scp) +-- print(data.ref) +end -- cgit v1.2.3-70-g09d2