Code Monkey home page Code Monkey logo

allennlp-srl-verb's Introduction

To set up the environment and run the model, follow the following workflow:

Create the virtual environment and set up installs:

python3 -m venv verb_srl_venv
cd verb_srl_venv
source bin/activate
pip install allennlp==1.0.0rc3
pip install allennlp-models==1.0.0rc3

Check that the lib/python3.6/site-packages/allennlp_models/syntax/srl/ folder has srl-eval.pl. If it does not, wget it from here and put it in that folder.

The GPUs on the CCG machines are CUDA version 10.1, so we set Pytorch back to version 1.4:

pip install torch===1.4.0 torchvision===0.5.0 -f https://download.pytorch.org/whl/torch_stable.html

Then we set up the paths and model files, which are at bert_base_srl.jsonnet and set_paths.sh. Note that these paths are set up as of 5/18/20 and only work on the CCG machines, and the paths may have changed since then.

To train:

. ./set_paths.sh
allennlp train bert_base_srl.jsonnet -s srl-bert-test --include-package allennlp_models

To evaluate:

allennlp evaluate srl-bert-test/model.tar.gz /shared/celinel/LDC2013T19/conll-formatted-ontonotes-5.0/conll-formatted-ontonotes-5.0/data/test

To predict:

allennlp predict srl-bert-model/model.tar.gz input.txt --output-file output.txt

The input and output files for the predict call are in JSON format. Inputs should be formatted such that sentences are separated into individual sentences, rather than one large paragraph.

To predict a single sentence, without an input JSON file. The output will be in TextAnnotation view format:

python predict_sentence.py srl-bert-test/model.tar.gz "The fox jumped over the fence, and the fence fell down." --output_file test_nofile_output.txt 

allennlp-srl-verb's People

Contributors

celine-lee avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

feiward

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.