https://github.com/FudanNLP/Capsule4TextClassification
Tip revision: f14644bce2e7f8adb0875c197317abe76f29d6fc authored by Jerrik on 06 June 2018, 09:48:52 UTC
udpate README
udpate README
Tip revision: f14644b
README.md
# Capsule4TextClassification
Implementation of our paper
["Information Aggregation via Dynamic Routing for Sequence Encoding"](https://arxiv.org/pdf/1806.01501.pdf)
# Sytem Requirements
OS: Linux (Ubuntu 14.04+)
Python: v3.6
Tensorflow: v1.4.0
Numpy: v1.14
CUDA : v8.0
CUDNN: v6.0
# Data Dowload
Refer to [downloadDataset](./data/downloadDataset.md) for data download instructions
# Quick start
Please first refer to [Data Dowload](./data/downloadDataset.md) and download all the data needed,
Go to root of this project `Capsule4TextClassification`, then type the following
command to start training process on correspoding dataset.
```bash
#for sentence level datasets, more specifically for SST-1 and SST-2 datasets
python ./caps_attn_flatten/train_test.py --load-config --weight-path ./savings/sst01
python ./caps_attn_flatten/train_test.py --load-config --weight-path ./savings/sst02
#for document level datasets, more specifically for imdb, yelp-2013 and yelp-2014
python ./caps_attn_hierarchical/train_test.py --load-config --weight-path ./savings/imdb
python ./caps_attn_hierarchical/train_test.py --load-config --weight-path ./savings/yelp2013
python ./caps_attn_hierarchical/train_test.py --load-config --weight-path ./savings/yelp2014
```
#### further explanation of the comamnd:
Note that we provide a sentence level model (caps_attn_flatten) and a document level model (caps_attn_hierarchical)
Take first command for example `--load-config` indicates that before construction of the computational graph we will
load a config file from a directory which ever `--weight-path` specifies, in this case `./savings/sst01`.
There is a `./savings/sst01/config` file that controls the configuration of the model, if you ever want to run
another configuration, you should simply copy the `./savings/sst01` directory and modify the config file,
and then run a command similar to those specified as above.
`--weight-path` specifies in which directory we want to store our config file, and most importantly the model checkpoint.
Also a `status` file, which is originally used to avoid conflict.
**note that if you ever encountered "process running or finished" error, you should remove `status` file**.