summaryrefslogtreecommitdiff
path: root/htk_io/examples/tnet_sgd_buffer.lua
blob: 152d2f5a38e8495ffce9a54652c67d7e890fea76 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
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 = {
                    ["<input>[1]"] = "blayer1[1]",
                    ["blayer1[1]"] = "wlayer1[1]",
                    ["wlayer1[1]"] = "blayer2[1]",
                    ["blayer2[1]"] = "wlayer2[1]",
                    ["wlayer2[1]"] = "<output>[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