Coder Social home page Coder Social logo

lattice's Introduction

Lattice

Code for our paper Robust (Controlled) Table-to-Text Generation with Structure-Aware Equivariance Learning at NAACL 2022. If you find the code useful, please cite the following paper.

@inproceedings{wang2022robust,
  title={Robust (Controlled) Table-to-Text Generation with Structure-Aware Equivariance Learning},
  author={Wang, Fei and Xu, Zhewei and Szekely, Pedro and Chen, Muhao},
  booktitle={Proceedings of the 2022 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies},
  year={2022}
}

Quick Links

Overview

Previous table-to-text generation methods suffer from the loss of structural information and are brittle to table layout change. Lattice alters Transformer with a structure-aware self-attention mechanism, and a tranformation-invariant positional encoding mechanism to address the aforementioned problems.

Requirements

pip install -r requirements.txt

Train

You can train your own model following these steps.

  1. Download ToTTo dataset
 wget https://storage.googleapis.com/totto-public/totto_data.zip
 unzip totto_data.zip
  1. Preprocess data
python preprocess/preprocess_data.py --input_path="totto_data/totto_dev_data.jsonl" --output_path="totto_data/dev_linearized.jsonl"
python preprocess/json_to_csv.py -i totto_data/dev_linearized.jsonl -o totto_data/dev.csv

python preprocess/preprocess_data.py --input_path="totto_data/totto_train_data.jsonl" --output_path="totto_data/train_linearized.jsonl"
python preprocess/json_to_csv.py -i totto_data/train_linearized.jsonl -o totto_data/train.csv
  1. Train model
bash run.sh

After running the script, you will get trained model weights, training logs, and results in the output folder, including the predicted summaries in generated_predictions.txt.

Note that the evaluation process for each checkpoint during training are simplified for efficiency, so the BLEU scores are lower than the final evaluation results. You can change the setting according to this post. To get accurate scores, please use the official evaluation tool. You can also submit your predictions to the official leaderboard through this form.

Robustness Evaluation

To get the hard version of ToTTo introduced in section 3.3 of our paper, a simple way is to perturb the row/column indexes of highlighted_cell at the end of the get_highlighted_subtable function. We apply the following three content-neutral table transformations:

  • row shuffling -- map row indexes to a different permutation;
  • column shuffling -- map column indexes to a different permutation;
  • table transposing -- swap row and column indexes.

lattice's People

Contributors

feiwang96 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.