Training Techniques | Adam |
---|---|
Architecture | Convolution, Dropout, ELMo, ESIM, Feedforward Network, Highway Layer, LSTM, Linear Layer, ReLU, Variational Dropout |
LR | 0.0004 |
SHOW MORE |
This model implements the ESIM model, which is a sequential neural inference model based on chain LSTMs.
from allennlp_models.pretrained import load_predictor
predictor = load_predictor("pair-classification-esim")
premise = "A man in a black shirt overlooking bike maintenance."
hypothesis = "A man destroys a bike."
preds = predictor.predict(premise, hypothesis)
for label, prob in zip(labels, preds["label_probs"]):
print(f"p({label}) = {prob:.2%}")
# prints:
# p(entailment) = 1.52%
# p(contradiction) = 81.70%
# p(neutral) = 16.78%
You can also get predictions using allennlp command line interface:
echo '{"premise": "A man in a black shirt overlooking bike maintenance.", "hypothesis": "A man destroys a bike."}' | \
allennlp predict https://storage.googleapis.com/allennlp-public-models/esim-elmo-2020.11.11.tar.gz -
To evaluate the model on Stanford Natural Language Inference (SNLI) dev set run:
allennlp evaluate https://storage.googleapis.com/allennlp-public-models/esim-elmo-2020.11.11.tar.gz \
https://allennlp.s3.amazonaws.com/datasets/snli/snli_1.0_test.jsonl
To train this model you can use allennlp
CLI tool and the configuration file esim.jsonnet:
allennlp train esim.jsonnet -s output_dir
See the AllenNLP Training and prediction guide for more details.
@inproceedings{Chen2017EnhancedLF,
author = {Qian Chen and Xiao-Dan Zhu and Z. Ling and Si Wei and Hui Jiang and Diana Inkpen},
booktitle = {ACL},
title = {Enhanced LSTM for Natural Language Inference},
year = {2017}
}