This repo provides the best MT-LSTM from the paper Learned in Translation: Contextualized Word Vectors (McCann et. al. 2017). For a high-level overview of why CoVe are great, check out the post.
example.py uses torchtext to load the Stanford Natural Language Inference Corpus and GloVe.
It uses a PyTorch implementation of the MTLSTM class in mtlstm.py to load a pretrained encoder, which takes in sequences of vectors pretrained with GloVe and outputs CoVe.
Install Docker. Install nvidia-docker if you would like to use with with a GPU.
docker pull bmccann/cove # pull the docker image
docker run -it cove # start a docker container
python /cove/test/example.py
Install PyTorch.
git clone https://github.com/salesforce/cove.git # use ssh: [email protected]:salesforce/cove.git
cd cove
pip install -r requirements.txt
python setup.py develop
python test/example.py
If using this code, please cite:
B. McCann, J. Bradbury, C. Xiong, R. Socher, Learned in Translation: Contextualized Word Vectors
@article{McCann2017LearnedIT,
title={Learned in Translation: Contextualized Word Vectors},
author={Bryan McCann and James Bradbury and Caiming Xiong and Richard Socher},
journal={arXiv preprint arXiv:1708.00107},
year={2017}
}
Contact: [email protected]