Skip to content

Code for our work "Read, Highlight and Summarize: A Hierarchical Neural Semantic Encoder-based Approach"

Notifications You must be signed in to change notification settings

rajeev595/RHS_HierNSE

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Requirements

  • Tensorflow == 1.9.0
  • NLTK
  • joblib == 0.13.2

Files

  • run_model.py: This file has all the flags needed for training, it chooses the data module, models and starts training.
  • utils.py: Utilities module containing DataGenerators, Parallel model etc.
    • DataGenerator: Creates batches for vanilla NSE.
    • DataGeneratorHier: Creates batches for hierarchical NSE.
  • Memory: All the files below contain a variant of NSE.
    • NSE: This is a neural semantic encoder class.
    • HierNSE: This is the hier-NSE class.
  • models: All the files below contain an encoder, decoder, loss, optimizer functions that use an NSE.
    • model.py: Model using vanilla NSE.
    • model_hier.py: Model using hier-NSE (use this).
    • model_hier_sc.py: Self-Critic model (use this). It carefully back-propagates through the same multinomial samples that are sampled while forward pass.
  • rouge: Rouge scripts used.
    • rouge_batch: A NumPy implementation (faster than existing ones). Used outside the TensorFlow graph.
  • Data
    • Create a folder named data
    • Download the following splits into data folder: train, val, test
    • Download the CNN and Daily-Mail tokenized data: CNN, DM
    • Download GloVe

supervised model

  • Training

      python run_model.py --model="hier" --mode="train" --PathToCheckpoint=/path/to/checkpoint --PathToTB=/path/to/tensorboard/logs
    
  • Testing

    • Check the epoch number of the best supervised model from TensorBoard, let it be X

      python run_model.py --model="hier" --mode="test" --PathToCheckpoint=/path/to/checkpoint/model_epochX --PathToResults=/path/to/results
      
  • Evaluation

      python run_model.py --model="hier" --mode="eval" --PathToResults=/path/to/results
    

self-critical model

  • Training

    • First copy the best supervised model to the rl checkpoint.

        python run_model.py --model="rlhier" --mode="train" --restore=True --PathToCheckpoint=/path/to/checkpoint --PathToTB=/path/to/tensorboard/logs
      
  • Testing

    • Check the epoch number of the best supervised model from TensorBoard, let it be X.

        python run_model.py --model="rlhier" --mode="train" --restore=True --PathToCheckpoint=/path/to/checkpoint/model_epochX --PathToResults=/path/to/results
      
  • Evaluation

        python run_model.py --model="rlhier" --mode="eval" --PathToResults=/path/to/results
    

About

Code for our work "Read, Highlight and Summarize: A Hierarchical Neural Semantic Encoder-based Approach"

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages