mirror of
https://github.com/wassname/Castor.git
synced 2026-09-26 13:20:14 +08:00
Initial implementation of RNNs for relation prediction described by Ture and Jojic: https://arxiv.org/abs/1606.05029
Setup:
- Create 3 directories under "simple_qa_rnn" - "resources", "datasets", "saved_checkpoints"
- Download the SimpleQA dataset from here and put it under the "datasets" directory
- Download these files from this Dropbox link and paste them in the "resources" directory
- The directory structure should look like this now:
simple_qa_rnn
├── datasets
│ └── SimpleQuestions_v2
│ ├── ...
├── model.py
├── README.md
├── resources
│ ├── rel_to_ix_SQ.pkl
│ ├── w2v_map_SQ.pkl
│ └── word_to_ix_SQ.pkl
├── saved_checkpoints
│ └── [...models will be saved here later...]
├── scripts
│ ├── ...
├── train.py
└── util.py
- Please take a look at the arguments in utils.py and set them accordingly to train the model.
- Run this command to train the model. Make sure you have PyTorch and other Python dependencies installed.
python train.py
NOTE: There are pre-trained models saved in the 'finished_checkpoints' directory. They can be loaded up using PyTorch. You can run a pre-trained model on the test dataset:
python train.py --not_bidirectional --resume_snapshot finished_checkpoints/lstm1/[model_filename] --test