The code is a simple implement of the popular deep learning model --- seq2seq. Here we use python to process the dataset, because it's more efficient than Torch, and the other codes are all written by Torch.
preprocessing.pyis used for processing the LCSTS dataset, which aims to solve Chinese short text summarization task. Because of the large size and the copyright, we don't publish it here. If you are interested in it, you can send an application form to get. Also, you can use other datasets instead if you are glad to.
You must process dataset before you run the training code,
python preprocessing.py-
Summarization.luais a wrapper file which containsDatasetclass andSeq2Seqclass. -
Dataset.luais a class to achieve data from hdf5 file processed by python. -
Seq2Seq.luais a class to build seq2seq model. -
Train.luacontains all the training processes.
You can run th Train.lua directly to train seq2seq model.
If you want to use GPU, you can run:
th Train.lua --openclor
th Train.lua --cudaBefore running code, you need to ensure the packages below installed:
hdf5, a file format connect python and torch
For python,
pip install h5pyFor torch,
luarocks install hdf5jieba, a popular Chinese Tokenizer
For python,
pip install jiebarnn, a rnn package for RNN model, like LSTM, GRU etc.
For torch , luarocks install rnn
If you need to use cuda or opencl, please install packages below:
- opencl
luarocks install cltorchluarocks install clnn- cuda
luarocks install cutorchluarocks install cunn-
Beam Search, to generate a more excellent summarzation. -
Attention Model, to implement a soft attention layer in model part.