Giter Site home page Giter Site logo

dreamerlll / wsd-biencoders Goto Github PK

View Code? Open in Web Editor NEW

This project forked from facebookresearch/wsd-biencoders

0.0 0.0 0.0 63 KB

Experiment code for the ACL 2020 paper "Moving Down the Long Tail of Word Sense Disambiguation with Gloss Informed Bi-encoders".

License: Other

Python 100.00%

wsd-biencoders's Introduction

Gloss Informed Bi-encoders for WSD

This is the codebase for the paper Moving Down the Long Tail of Word Sense Disambiguation with Gloss Informed Bi-encoders.

Architecture of the gloss informed bi-encoder model for WSD Our bi-encoder model consists of two independent, transformer encoders: (1) a context encoder, which represents the target word (and its surrounding context) and (2) a gloss encoder, that embeds the definition text for each word sense. Each encoder is initalized with a pertrained model and optimized independently.

Dependencies

To run this code, you'll need the following libraries:

We used the WSD Evaluation Framework for training and evaluating our model.

How to Run

To train a biencoder model, run python biencoder.py --data-path $path_to_wsd_data --ckpt $path_to_checkpoint. The required arguments are: --data-path, which is the filepath to the top-level directory of the WSD Evaluation Framework; and --ckpt, which is the filepath of the directory to which to save the trained model checkpoints and prediction files. The Scorer.java in the WSD Framework data files needs to be compiled, with the Scorer.class file in the original directory of the Scorer file.

It is recommended you train this model using the --multigpu flag to enable model parallel (note that this requires two available GPUs). More hyperparameter options are available as arguments; run python biencoder.py -h for all possible arguments.

To evaluate an existing biencoder, run python biencoder.py --data-path $path_to_wsd_data --ckpt $path_to_model_checkpoint --eval --split $wsd_eval_set. Without --split, this defaults to evaluating on the development set, semeval2007. The model weights and predictions for the biencoder reported in the paper can be found here.

Similar commands can be used to run the frozen probe for WSD (frozen_pretrained_encoder.py) and the finetuning a pretrained, single encoder classifier for WSD (finetune_pretrained_encoder.py).

Citation

If you use this work, please cite the corresponding paper:

@inproceedings{
  blevins2020wsd,
  title={Moving Down the Long Tail of Word Sense Disambiguation with Gloss Informed Bi-encoders},
  author={Terra Blevins and Luke Zettlemoyer},
  booktitle={Proceedings of the 58th Association for Computational Linguistics},
  year={2020},
  url={https://blvns.github.io/papers/acl2020.pdf}
}

Contact

Please address any questions or comments about this codebase to [email protected]. If you want to suggest changes or improvements, please check out the CONTRIBUTING file for how to help out.

License

This codebase is Attribution-NonCommercial 4.0 International licensed, as found in the LICENSE file.

wsd-biencoders's People

Contributors

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