Loading text file training data into torch7

628 views
Skip to first unread message

hjolin

unread,
Dec 2, 2015, 6:16:38 AM12/2/15
to torch7
Hi everyone,

I am new to torch, now I have some training data in a text file in which each line is a training sample. I am wondering what is the best way to load these data into torch as a torch.Tensor to do model training. Should I read this file with normal lua io functions and then convert it into torch.Tensor or to use some built-in functions in torch?

Appreciate your answers,
Thanks.

João Felipe Santos

unread,
Dec 13, 2015, 12:18:42 PM12/13/15
to torch7
This file from Karpathy's char-rnn repo might give you some ideas: https://github.com/karpathy/char-rnn/blob/master/util/CharSplitLMMinibatchLoader.lua. It basically reads the file using Lua functions and creates Torch tensors where the characters are replaced by a unique integer identifier.
Reply all
Reply to author
Forward
0 new messages