GithubHelp home page GithubHelp logo

ibm / regen Goto Github PK

View Code? Open in Web Editor NEW
34.0 7.0 5.0 581 KB

official code for EMNLP21 paper

License: Apache License 2.0

Python 85.63% Shell 14.37%
machine-learning knowledge-graph webnlg natural-language-processing natural-language-generation deep-learning reinforcement-learning pytorch

regen's Introduction

ReGen: Reinforcement Generation for bi-directional Text and Knowledge Base using Pretrained Language Models

Summary

This is the official code for ReGen from our EMNLP21 paper

For a quick introduction to ReGen, please read our short description.

For a more detailed explanation, please check our paper ReGen: Reinforcement Learning for Text and Knowledge Base Generation using Pretrained Language Models or a more up to date version on arXiv

The code was released on December 10th, 2021

ReGen

ReGen stands for Reinforced Generation for Graph-to-Text and Text-to-Graph generative tasks.
Details are given in the long paper ReGen: Reinforcement Learning for Text and Knowledge Base Generation using Pretrained Language Models that was presented as an oral presentation at EMNLP 2021 main conference. A version of the paper that will be updated w/ new results can be found on arXiv.

Contacts:

  • Pierre Dognin pdognin{at_}us[dot_]ibm[_dot]com
  • Inkit Padhi inkit.padhi[_at]ibm{dot}com

Requirements

  • Python (3.8)
  • PyTorch (1.7.1)
  • transformers (4.2.2)
  • nltk (>=3.6.3)

Install these packages in conda environment regen with:

conda env create -f setup.yml

Install nltk (>=3.6.3) by hand

conda activate regen
pip install --user 'nltk>=3.6.3'

Note: we assume in this documentation that you have activated the conda environment by using:

conda activate regen

Datasets

Two datasets were used in our experimentss:

To install the datasets, prepare references for evaluations, please look at the steps in datasets documentation

Evaluation Metrics

Evaluations of generation results are performed using the WebNLG offical evaluation packages for both datasets.
For Reinforcement Learning training, rewards are derived from evaluation metrics and are required for RL fine-tuning models.

Installation steps are given in evaluation documentation

Training

We can train model for 2 generative tasks:

  • G2T (graph-to-text) task that will generate text from a graph input
  • T2G (text-to-graph) task that will generate a graph from input sentences

Models are trained from a Pretrained Language Model (PLM) T5 in two steps:

  1. Fine-tuning of a T5 large model using Cross-Entropy (CE). This is our CE model
  2. CE model is fine-tuned using Self-Critical Sequence Training (SCST) (Rennie, et al., 2017), a variant of REINFORCE (Williams, 1992)

We give instructions on training a model on the WebNLG/TekgGen datasets below.
The training scripts are based on PyTorch implementation using PLMs from HuggingFace
The code can handle multiple GPUs training out-of-the-box. Shell scripts to facilitate training and evaluation are provided Scripts

WebNLG Training

TekGen Training


How to Cite

@inproceedings{dognin-etal-2021-regen,
    title = "{R}e{G}en: {R}einforcement Learning for Text and Knowledge Base Generation using Pretrained Language Models",
    author = "Dognin, Pierre  and
      Padhi, Inkit  and
      Melnyk, Igor  and
      Das, Payel",
    booktitle = "Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing",
    month = nov,
    year = "2021",
    address = "Online and Punta Cana, Dominican Republic",
    publisher = "Association for Computational Linguistics",
    url = "https://aclanthology.org/2021.emnlp-main.83",
    pages = "1084--1099",
    abstract = "Automatic construction of relevant Knowledge Bases (KBs) from text, and generation of semantically meaningful text from KBs are both long-standing goals in Machine Learning. In this paper, we present ReGen, a bidirectional generation of text and graph leveraging Reinforcement Learning to improve performance. Graph linearization enables us to re-frame both tasks as a sequence to sequence generation problem regardless of the generative direction, which in turn allows the use of Reinforcement Learning for sequence training where the model itself is employed as its own critic leading to Self-Critical Sequence Training (SCST). We present an extensive investigation demonstrating that the use of RL via SCST benefits graph and text generation on WebNLG+ 2020 and TekGen datasets. Our system provides state-of-the-art results on WebNLG+ 2020 by significantly improving upon published results from the WebNLG 2020+ Challenge for both text-to-graph and graph-to-text generation tasks. More details at https://github.com/IBM/regen.",
}

Bibliography

Rennie, S. J. et al., 2017. Self-critical Sequence Training for Image Captioning. Honolulu, Hawaii, Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition.

Williams, R. J., 1992. Simple Statistical Gradient-following Algorithms for Connectionist Reinforcement Learning. Machine learning, 8(3), pp. 229-256.

regen's People

Contributors

pdognin avatar stevemar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

regen's Issues

Important Help Needed

Please give me a step by step guide on how to setup and run the project locally. I am highly interested in this work and would appreciate a lot if you can guide me. Thanks

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.