Giter VIP home page Giter VIP logo

herman's Introduction

Herman

This repository contains code for the EMNLP 2020 Findings paper Reducing Quantity Hallucinations in Abstractive Summarization.

Required packages

The code uses python 3.6 with the following packages:

  • pytorch 1.2.0
  • torchtext 0.4.0
  • spacy (only needed for preprocessing data)
  • allennlp
  • sklearn

Get the dataset

The dataset is in csv format with id, article, summary, label, label_binary, quantity_label fields

  • article: the original article
  • summary: the summary of the article
  • label: the tag sequence Y described in the paper Sec 3.1
  • label_binary: the binary summary-level label z described in the paper Sec 3.1
  • quantity_label: the sequence of binary labels M described in the paper Sec 3.1

You can download the dataset here. Unzip the data using the following command:

tar xvzf herman_data.tar.gz 

How to run

Use the following command to train the Herman system

python run.py --task=train --checkpoint=checkpoint_name --file_path=dataset_path --file_train=train_data_filename

The code can be trained on 1 Nvidia GTX1080Ti GPU with 11GB memory with batch_size 32.

To use the trained checkpoint and make label prediction and calculate scores in order to re-rank summaries, use the following code:

python predict.py --task=test --checkpoint=checkpoint_path --file_path=dataset_path --file_output=output_file_path --file_test=test_data_filename

Note that the test set should be beams of summaries generated from any summarization system. The test set need to be in csv format with article, summary, quantity_label fields.

After running the code, you will get three output files, one with the predicted labels, one with the global scores, and one with the local scores. Both the global score and local score can be used to re-rank summaries.

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.