MLGCN-DP for Story Ending Generation
Code for paper "Story Ending Generation with Multi-Level Graph Convolutional Networks over Dependency Trees", AAAI 2021.
Prerequisites
- Python 3.6
- PyTorch == 1.9.0
Quick start:
- Dataset
All dataset under the directory of data
, include ROCStories corpus (data/test
, data/train
, data/val
) and the dependency parsing relations (data/DP-data.zip
, unzip it to use). We utilize the glove embedding, please download the glove.6b.300d.txt and put it in directory of data/embedding
.
- Data preprocess
Run following command:
python data_preprocess.py
python embed_vocab.py
Then we will get three files
data/final_gcn_data.pt
data/embedding/embedding_enc.pt
data/embedding/embedding_dec.pt
- Training
Run command:
python train.py -gpu 0
- Inference
Run command:
python generate_story.py -gpu 0
Then the output file will be save in directory of story_generation/
PS
When calculate the BLEU, please uniform capitals and lower case letters of ref and hyp