• Stars
    star
    248
  • Rank 163,560 (Top 4 %)
  • Language
    Python
  • License
    Apache License 2.0
  • Created about 7 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Cleaned code for paper "Natural Language Inference over Interaction Space"

Densely Interactive Inference Network (DIIN)

This is the code to reproduce the model in Natural Language Inference over Interaction Space.

Environment

python 3.6
tensorflow = 1.3

Setup

$ git clone https://github.com/YichenGong/Densely-Interactive-Inference-Network.git
$ cd Densely-Interactive-Inference-Network
$ pip install -r requirements.txt

Download Data

First, run download.py for the datasets and the preprocessed file:

$ cd data
$ python download.py

Then, manually download download MultiNLI 0.9 matched and mismatched test set under data/multinli_0.9 folder

If any of the auto download fails, you can manually download them from:

When you finish downloading, your data folder should look like this:

    $ tree data
    data
    โ”œโ”€โ”€ download.py
    โ”œโ”€โ”€ glove.840B.300d.txt
    โ”œโ”€โ”€ multinli_0.9
    โ”‚ย ย  โ”œโ”€โ”€ Icon\015
    โ”‚ย ย  โ”œโ”€โ”€ multinli_0.9_dev_matched.jsonl
    โ”‚ย ย  โ”œโ”€โ”€ multinli_0.9_dev_matched.txt
    โ”‚ย ย  โ”œโ”€โ”€ multinli_0.9_dev_mismatched.jsonl
    โ”‚ย ย  โ”œโ”€โ”€ multinli_0.9_dev_mismatched.txt
    โ”‚ย ย  โ”œโ”€โ”€ multinli_0.9_test_matched_sample_submission.csv
    โ”‚ย ย  โ”œโ”€โ”€ multinli_0.9_test_mismatched_sample_submission.csv
    โ”‚ย ย  โ”œโ”€โ”€ multinli_0.9_train.jsonl
    โ”‚ย ย  โ”œโ”€โ”€ multinli_0.9_train.txt
    โ”‚ย ย  โ””โ”€โ”€ paper.pdf
    โ”œโ”€โ”€ shared.jsonl
    โ””โ”€โ”€ snli_1.0
        โ”œโ”€โ”€ Icon\015
        โ”œโ”€โ”€ README.txt
        โ”œโ”€โ”€ snli_1.0_dev.jsonl
        โ”œโ”€โ”€ snli_1.0_dev.txt
        โ”œโ”€โ”€ snli_1.0_test.jsonl
        โ”œโ”€โ”€ snli_1.0_test.txt
        โ”œโ”€โ”€ snli_1.0_train.jsonl
        โ””โ”€โ”€ snli_1.0_train.txt

I don't recommend you to use multinli_1.0 here because the id doesn't match the id in preprocessed sample id.

To run the code

$ cd python 
# on MultiNLI
$ PYTHONHASHSEED=0 python train_mnli.py DIIN demo_testing 
# on SNLI
$ PYTHONHASHSEED=0 python train_mnli.py DIIN demo_testing_SNLI --training_completely_on_snli

License

Licensed under the Apache License, Version 2.0 (the "License"); you may not use these files except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.