Skip to content

Instantly share code, notes, and snippets.

@schmmd
Last active January 6, 2018 14:07
Show Gist options
  • Save schmmd/713d4e9291197772edcb85218dcda9ed to your computer and use it in GitHub Desktop.
Save schmmd/713d4e9291197772edcb85218dcda9ed to your computer and use it in GitHub Desktop.
AllenNLP Commands

SRL

Prediction

echo '{"sentence": "Did Uriah honestly think he could beat the game in under three hours?"}' > examples.jsonl
allennlp/run predict https://s3-us-west-2.amazonaws.com/allennlp/models/srl-model-2017.09.05.tar.gz examples.jsonl

Evaluation

The SRL model was evaluated on the CoNLL 2012 dataset. Unfortunately we cannot release this data due to licensing restrictions by the LDC. You can put together evaluation data yourself by following the instructions at http://conll.cemantix.org/2012/data.html.

Machine Comprehension / BiDAF

Prediction

echo '{"passage": "A reusable launch system (RLS, or reusable launch vehicle, RLV) is a launch system which is capable of launching a payload into space more than once. This contrasts with expendable launch systems, where each launch vehicle is launched once and then discarded. No completely reusable orbital launch system has ever been created. Two partially reusable launch systems were developed, the Space Shuttle and Falcon 9. The Space Shuttle was partially reusable: the orbiter (which included the Space Shuttle main engines and the Orbital Maneuvering System engines), and the two solid rocket boosters were reused after several months of refitting work for each launch. The external tank was discarded after each flight.", "question": "How many partially reusable launch systems were developed?"}' > examples.jsonl
allennlp/run predict https://s3-us-west-2.amazonaws.com/allennlp/models/bidaf-model-2017.09.15-charpad.tar.gz examples.jsonl

Evaluation

allennlp/run evaluate --archive_file https://s3-us-west-2.amazonaws.com/allennlp/models/bidaf-model-2017.09.15-charpad.tar.gz --evaluation_data_file https://s3-us-west-2.amazonaws.com/allennlp/datasets/dev-v1.1.json --cuda_device 0

Textual Entailment

Prediction

echo '{"hypothesis": "Two women are sitting on a blanket near some rocks talking about politics.", "premise": "Two women are wandering along the shore drinking iced tea."}' > examples.jsonl
allennlp/run predict https://s3-us-west-2.amazonaws.com/allennlp/models/decomposable-attention-2017.09.04.tar.gz examples.jsonl

Evaluation

allennlp/run evaluate --archive_file https://s3-us-west-2.amazonaws.com/allennlp/models/decomposable-attention-2017.09.04.tar.gz --evaluation_data_file https://s3-us-west-2.amazonaws.com/allennlp/datasets/snli_1.0_test.jsonl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment