Improved README (#11)

Issue #1 : Readme instructions updated for running the model
This commit is contained in:
gauravbaruah
2017-04-05 13:41:25 -04:00
committed by Jimmy Lin
parent d4ac752cf2
commit 906218b623
2 changed files with 54 additions and 26 deletions
+1 -1
View File
@@ -10,7 +10,7 @@ Pytorch deep learning models.
You need Python 3.6 to use the models in this repository.
As per [pytorch.org](pytorch.org),
> [Anaconda](https://www.continuum.io/downloads) is our recommended package manager
> "[Anaconda](https://www.continuum.io/downloads) is our recommended package manager"
```conda install pytorch torchvision -c soumith```
+53 -25
View File
@@ -4,45 +4,73 @@
1. Aliaksei _S_everyn and Alessandro _M_oschitti. 2015. Learning to Rank Short Text Pairs with Convolutional Deep Neural Networks. In Proceedings of the 38th International ACM SIGIR Conference on Research and Development in Information Retrieval (SIGIR '15). ACM, New York, NY, USA, 373-382. DOI: http://dx.doi.org/10.1145/2766462.2767738
#### TODOs:
1. figure out if the L2 regularization is correct
2. Batch size of 50 (current batch_size = 1)
#### Requirements
### Requirements
gensim==1.0.1
nltk==3.2.2
numpy==1.11.3
pandas==0.19.2
torch==0.1.11+b13b701
#### Getting the data
Please install the requirements. See [Castor/README.md](../README.md) for pytorch installation details.
git clone [castorini/data](https://github.com/castorini/data)
### Training the model
castorini/data contains:
1. Setup repository layout.
```word2vec/aquaint+wiki.txt.gz.ndim=50.bin```: word embeddings.
Note that a memory mapped cache will be created on first use on your disk, when you run ```main.py``` (below).
```TrecQA/```: the directory with the input data for training the model.
Follow instructions in castorini/data/TrecQA/README.md to preprocess data for it to be ingestable by the model.
#### Running the model
``1.`` Make TrecEval:
```
$ cd trec_eval-8.0
$ make clean
$ make
mkdir castorini
cd castorini
git clone https://github.com/castorini/data.git
git clone https://github.com/castorini/models.git
git clone https://github.com/castorini/Castor.git
```
``2.`` To run the S&M model on TrecQA, please follow the same parameter setting:
This should generate:
```
$ python main.py ../../model/sm.model.aquaint.train-all --train_all
├── Castor
│   ├── castorini_smmodel_bridge.py
│   ├── README.md
│   └── sm_model/
├── data
│   ├── README.md
│   ├── TrecQA/
│   └── word2vec/
└── models
├── README.md
└── sm_model/
```
The final model will be saved to ```../../model/sm.model.aquaint.train-all```
2. Preprocess data
```
cd data/TrecQA
python3 parse.py
python3 overlap_features.py
python3 build_vocab.py
```
3. Download word embeddings from [here](https://drive.google.com/folderview?id=0B-yipfgecoSBfkZlY2FFWEpDR3M4Qkw5U055MWJrenE5MTBFVXlpRnd0QjZaMDQxejh1cWs&usp=sharing) and save the ``aquaint+wiki.txt.gz.ndim=50.bin`` into ``data/word2vec/``.
4. Train the model
Make trec_eval
```
cd Castor/sm_model/
cd trec_eval-8.0
make clean && make
cd ..
```
To train the S&M model on TrecQA
```
python main.py ../../model/sm_model/sm_model.train-all --train_all
```
The final model will be saved to ```../../model/sm_model/sm_model.train-all```
_NOTE:_ On first run, the program will create a memory-mapped cache for word e mbeddings (943MB) in ``data/word2vec``.
The cache allows for faster loading of data in future runs.
Run ```python main.py -h``` for more default options.