Pages

Thursday, 22 October 2015

Running the CURRENNT rnn library

Previously I have made posts about installing Currennt and writing data files for Currennt. This post will be about actually running it assuming it is installed and the data files have been written.

The first thing you'll need to specify is the config file, which I called config.cfg. Its contents look like this:

max_epochs_no_best   = 20
max_epochs           = 100
learning_rate        = 1e-5
network              = network.jsn 
train                = true
train_file           = full_train_currennt.nc
val_file             = full_test_currennt.nc
weights_dist         = normal
weights_normal_sigma = 0.1
weights_normal_mean  = 0
stochastic           = true
validate_every       = 1
parallel_sequences   = 20
input_noise_sigma    = 0
shuffle_fractions    = true
shuffle_sequences    = false

Many of the options are described on the currennt wiki. The network.jsn is a file that I will describe down below and contains the network configuration e,g, number of layers, layer types etc. The files full_train_currennt.nc and full_test_currennt.nc were created using the MATLAB script in a previous post. If you set parallel sequences too high you'll run out of memory on your GPU, but higher means it will train faster.

The network configuration

Info on the network configuration can be found over here. The network I used looks like this:

{
    "layers": [
        {
            "size": 20,
            "name": "input",
            "type": "input"
        },
        {
            "size": 200,
            "name": "level_1",
            "bias": 1.0,
            "type": "blstm"
        },
        {
            "size": 200,
            "name": "level_2",
            "bias": 1.0,
            "type": "blstm"
        },
        {
            "size": 4,
            "name": "output",
            "bias": 1.0,
            "type": "softmax"
        },
        {
            "size": 4,
            "name": "postoutput",
            "type": "multiclass_classification"
        }
    ]
}

actually running stuff

Now to run things, just do:

/path/to/currennt/build/current config.cfg

and everything should work, just wait for it to finish training. This will output a file called trained_network.jsn which we will need during testing. For testing, you will need another HDF5 file just like the training one, except with the test sequences in it. For testing we have another config file which I called ff_config:

network          = trained_network.jsn
cuda             = 0
ff_output_format = csv
ff_output_file   = test_results
ff_input_file    = full_test_currennt.nc

Notice that cuda is off, I found it ran faster in feed forward mode without cuda. To do testing run:

/path/to/currennt/build/current ff_config.cfg

Now all you need to do is parse the output file test_results.csv if you need the individual predictions, it is in comma separated variable format so it is not hard to work out.

1 comment:

  1. Thanks for your instruction.I have followed to run the files in the examples of CURRENNT library (https://sourceforge.net/p/currennt/code/ci/master/tree/examples/speech_recognition_chime/) and I end with this error : Maximum number of training epochs reached. Training stopped.
    Lowest validation error: 279.728271

    Storing the trained network in 'trained_network.jsn'... FAILED: Cannot open file Please help me to fix this issue.

    ReplyDelete