Code Monkey home page Code Monkey logo

syntax-augmented-bert's Introduction

Syntax-Augmented BERT Models

This repo contains authors' original implementation for the paper Do Syntax Trees Help Pre-trained Transformers Extract Information? In this work, we explore different methods for adding syntactic structures into existing pretrained Transformer models, and evaluate their effectiveness on SRL, NER and relation extraction tasks.

Diagrams


Reproduce results on the CoNLL-2005 SRL task using bert-base weights

Steps

  • Download BERT/RoBERTa model weights from Huggingface by running the command
bash download_bert_model.sh

This script will create a directory "hf-bert-weights" and download the weights of four models. Warning: The size of the directory would

  • Create a virtualenv named pyt using python3.6+ as
python3.6+ -m venv $HOME'/.virtualenvs/pyt'

Install the dependencies from the requirements.txt file as

pip install -r requirements.txt
  • Include the CoNLL-2005 SRL task dataset under the datasets directory. As the distribution of this dataset is not freely allowed, for reference, this codebase includes 1000 lines for each files contained in the dataset.

  • Now, run the provided script run_conll_srl.sh as:

bash run_conll_srl.sh

Also, make sure that the variable path settings in lines 12-21 of the above script are correct.

  • In case of any confusions, errors or bugs, please report it in the Issues section.

Extras

Convert from PTB format to UDv2 format

Citation

If you find this code useful, please consider citing our paper as:

@inproceedings{sachan-etal-2021-syntax,
    title = "Do Syntax Trees Help Pre-trained Transformers Extract Information?",
    author = "Sachan, Devendra  and
      Zhang, Yuhao  and
      Qi, Peng  and
      Hamilton, William L.",
    booktitle = "Proceedings of the 16th Conference of the European Chapter of the Association for Computational Linguistics: Main Volume",
    month = apr,
    year = "2021",
    address = "Online",
    publisher = "Association for Computational Linguistics",
    url = "https://aclanthology.org/2021.eacl-main.228",
    doi = "10.18653/v1/2021.eacl-main.228"}

syntax-augmented-bert's People

Contributors

devsinghsachan avatar yuhaozhang 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.