Giter VIP home page Giter VIP logo

unirpg's Introduction

UniRPG

This is the code for the EMNLP 2022 Paper UniRPG: Unified Discrete Reasoning over Table and Text as Program Generation. Our code is based on the repository TAT-QA.

Environment

torch==1.7.1
transformers==3.3.0
fastNLP==0.6.0
allennlp==2.0.1
spacy==2.0.1

Training and Inference

The folder UniRPG_full is for training UniRPG with the derivation annotations while the folder UniRPG_weak is for the setting without the derivation annotations.

Preprocessing

First download pre-trained model BART and put files in the folder plm, then you should run the following scripts to preprocess training/dev/test data.
bash scripts/prepare_data_train.sh
bash scripts/prepare_data_dev.sh
bash scripts/prepare_data_test.sh
The preprocessed train/dev/test data is stored in the folder tag_op/cache/
Under weak supervision setting, you should first run the following command to convert multi-span instances to count instances, and then run the above preprocessing scripts.
python3 tag_op/data/count_instance_construction.py

Training

You should run the following scripts to train the UniRPG
bash scripts/train_bart_large.sh
The trained UniRPG model is saved in the folder checkpoint

Validation

First check the saved path of model in the following scripts and then run them to evaluate the trained model in dev set
bash scripts/validate.sh
bash scripts/execute.sh
bash scripts/eval.sh

Inference

Please check the saved path of model in the following scripts, and then predict the programs and execute them to get the answers of test instances.
bash scripts/predict.sh
bash scripts/execute.sh

Thanks for your citation.

@inproceedings{zhou-etal-2022-unirpg,
    title = "{U}ni{RPG}: Unified Discrete Reasoning over Table and Text as Program Generation",
    author = "Zhou, Yongwei  and
      Bao, Junwei  and
      Duan, Chaoqun  and
      Wu, Youzheng  and
      He, Xiaodong  and
      Zhao, Tiejun",
    booktitle = "Proceedings of the 2022 Conference on Empirical Methods in Natural Language Processing",
    month = dec,
    year = "2022",
    address = "Abu Dhabi, United Arab Emirates",
    publisher = "Association for Computational Linguistics",
    url = "https://aclanthology.org/2022.emnlp-main.508",
    pages = "7494--7507"
}

unirpg's People

Contributors

phddamuge avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 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.