Giter VIP home page Giter VIP logo

dilated-cnn-ner's Introduction

dilated-cnn-ner

This code implements the models described in the paper "Fast and Accurate Entity Recognition with Iterated Dilated Convolutions" by Emma Strubell, Patrick Verga, David Belanger and Andrew McCallum.

Requirements

This code uses TensorFlow v[1.0, 1.4) and Python 2.7.

It will probably train on a CPU, but honestly we haven't tried, and highly recommend training on a GPU.

Setup

  1. Set up environment variables. For example, from the root directory of this project:
export DILATED_CNN_NER_ROOT=`pwd`
export DATA_DIR=/path/to/conll-2003
  1. Get some pretrained word embeddings, e.g. SENNA embeddings or Glove embeddings. The code expects a space-separated file with one word and its embedding per line, e.g.:

    word 0.45 0.67 0.99 ...
    

    Make a directory for the embeddings:

    mkdir -p data/embeddings
    

    and place the file there.

  2. Perform all data preprocessing for a given configuration. For example:

./bin/preprocess.sh conf/conll/dilated-cnn.conf

This calls preprocess.py, which loads the data from text files, maps the tokens, labels and any other features to integers, and writes to TensorFlow tfrecords.

Training

Once the data preprocessing is completed, you can train a tagger:

./bin/train-cnn.sh conf/conll/dilated-cnn.conf

Evaluation

By default, the trainer will write the model which achieved the best dev F1. To evaluate a saved model on the dev set:

./bin/eval-cnn.sh conf/conll/dilated-cnn.conf --load_model path/to/model

To evaluate a saved model on the test set:

./bin/eval-cnn.sh conf/conll/dilated-cnn.conf test --load_model path/to/model

Configs

Configuration files (conf/*) specify all the data, parameters, etc. for an experiment.

dilated-cnn-ner's People

Contributors

ghaddarabs avatar sbrugman avatar strubell avatar

Watchers

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