Giter Site home page Giter Site logo

mloncode / structured-neural-summarization Goto Github PK

View Code? Open in Web Editor NEW

This project forked from coderpat/structured-neural-summarization

0.0 3.0 0.0 47 KB

A repository with the code for the paper with the same title

License: MIT License

Python 78.85% Shell 2.12% Java 19.03%
ml-on-code research tensorflow

structured-neural-summarization's Introduction

Structured Neural Summarization

A repository with the code for the paper with the same title. The experiments are based on the more general-purpose graph neural network library OpenGNN. You can install it by following it's README.md.

Experiments are based around the train_and_eval.py script. Besides the main experiments, this repo also contains the following folders:

  • Parsers: A collection of scripts to parse and process various datasets to the format used by the experiments
  • Data: A collection of scripts to utility functions to handle and analyse the formated data
  • Models: Some bash script wrapppers around the main script with some model/hyperparameter combination for diferent experiments

Getting Started

As an example, we will show how run a sequenced-graph to sequence model with attention on the CNN/DailyMail dataset. This assumed the process data is located in /data/naturallanguage/cnn_dailymail/split/{train,valid,test}/{inputs,targets}.jsonl.gz.

For instruction on how to process see the corresponding subfolder.

Start by build vocabularies for the node and edge labels in the input side and tokens in the output side by running

ognn-build-vocab --field_name node_labels \
                 --save_vocab /data/naturallanguage/cnn_dailymail/node.vocab \
                 /data/naturallanguage/cnn_dailymail/split/train/inputs.jsonl.gz
ognn-build-vocab --no_pad_token --field_name edges --string_index 0 \
                 --save_vocab /data/naturallanguage/cnn_dailymail/edge.vocab \
                 /data/naturallanguage/cnn_dailymail/split/train/inputs.jsonl.gz
ognn-build-vocab --with_sequence_tokens \
                 --save_vocab /data/naturallanguage/cnn_dailymail/output.vocab \
                 /data/naturallanguage/cnn_dailymail/split/train/inputs.jsonl.gz 

Then run

python train_and_eval.py   

This will create the model directory cnndailymail_summarizer, which contains tensorflow checkpoint and event files that can monitored in tensorboard.

We can also pass directly the file we wish to do inference on by running

python train_and_eval.py --infer_source_file /data/naturallanguage/cnn_dailymail/split/test/inputs.jsonl.gz \
                         --infer_predictions_file /data/naturallanguage/cnn_dailymail/split/test/predictions.jsonl

Then print the metrics on the predictions run

python rouge_evaluator /data/naturallanguage/cnn_dailymail/split/test/summaries.jsonl.gz \
                       /data/naturallanguage/cnn_dailymail/split/test/predictions.jsonl
                         

structured-neural-summarization's People

Contributors

coderpat avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.