jcjohnson / torch-rnn

Efficient, reusable RNNs and LSTMs for torch
MIT License
2.5k stars 508 forks source link

Can torch-rnn be used with 0 test and validation data? #35

Closed AlekzNet closed 7 years ago

AlekzNet commented 8 years ago

When I set --val_frac and --test_frac to "0" or to a value that produces val/test sizes less than batch_size * seq_length, I'm getting index errors:

Set to "0":

Running in CPU mode /home/alekz/torch/install/bin/luajit: bad argument #2 to '?' (too many indices provided at /tmp/luarocks_torch-scm-1-7800/torch7/generic/Tensor.c:929) stack traceback: [C]: at 0x7fb3edaf0b40 [C]: in function 'index' ./util/DataLoader.lua:30: in function 'init' /home/alekz/torch/install/share/lua/5.1/torch/init.lua:91: in function </home/alekz/torch/install/share/lua/5.1/torch/init.lua:87> [C]: in function 'DataLoader' train.lua:75: in main chunk [C]: in function 'dofile' ...lekz/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in main chunk [C]: at 0x00405d70

Set to 0.0001:

/home/alekz/torch/install/bin/luajit: bad argument #2 to '?' (end index out of bound at /tmp/luarocks_torch-scm-1-7800/torch7/generic/Tensor.c:967) stack traceback: [C]: at 0x7fcff2850b40 [C]: in function 'index' ./util/DataLoader.lua:30: in function 'init' /home/alekz/torch/install/share/lua/5.1/torch/init.lua:91: in function </home/alekz/torch/install/share/lua/5.1/torch/init.lua:87> [C]: in function 'DataLoader' train.lua:74: in main chunk [C]: in function 'dofile' ...lekz/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in main chunk [C]: at 0x00405d70

jcjohnson commented 8 years ago

I never thought someone would want to do that! To support this use case we could add some special-case logic in the DataLoader.

AlekzNet commented 8 years ago

The reasons are:

o- small training corpus o- the state, that should be carried over to the next mini-batch o- using big mini-batches will "remove" significant contiguous pieces of data from the training set o- in some cases, the result(s) can be better verified "manually"

dgcrouse commented 7 years ago

If you would like to add this, please implement it and submit a pull request.

dgcrouse commented 7 years ago

Closing because over a year since last comment.