Giter Club home page Giter Club logo

densely-interactive-inference-network's Introduction

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.

densely-interactive-inference-network's People

Contributors

uduse avatar yichengong avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

densely-interactive-inference-network's Issues

Max pooling in character embedding.

At line 32 in the my.tensorflow.nn.py, you used reduce_max. But in your paper, you said using max pooling after CNN to extract character features. Could you please explain it? Thanks!

No multinli_0.9_test_matched_unlabeled.jsonl

just about the readme section, the result tree data should be

data
├── download.py
├── embeddings
│   └── mnli_emb_snli_embedding.pkl.gz
├── glove.840B.300d.txt
├── glove.840B.300d.zip
├── __MACOSX
│   ├── multinli_0.9
│   └── snli_1.0
├── 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_unlabeled.jsonl
│   ├── multinli_0.9_test_mismatched_unlabeled.jsonl
│   ├── multinli_0.9_train.jsonl
│   ├── multinli_0.9_train.txt
│   └── paper.pdf
├── multinli_0.9.zip
├── shared.json
├── 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
└── snli_1.0.zip

6 directories, 26 files

There should be a multinli_0.9_test_matched_unlabeled.jsonl and multinli_0.9_test_mismatched_unlabeled.jsonl file to run the entire code.
And also ref to #5 , there should be a shared.jsonl file.

Pre-processing

Can anyone tell me how preprocessing files have been generated?

How to train on Quora dataset?

How can I apply this approach to Quora dataset? I saw the train_quora.py file, but what files are needed for it and how do I generate them?

Import error

I want to run the script of train_quora.py.But it seem that there is not the module of YF in the floder util

Traceback (most recent call last):
  File "train_quora.py", line 17, in <module>
    from util.YF import YFOptimizer
ImportError: No module named YF

How can I fix this error??

Error on PYTHONHASHSEED=0 python3 train_mnli.py DIIN demo_testing_SNLI --training_completely_on_snli

Everything is OK up to loading shared.jsonl but when data_processing.py tries to load it the following error is raised:

[1] Loading data SNLI
550152it [00:09, 55502.23it/s]
10000it [00:00, 58533.31it/s]
10000it [00:00, 64180.29it/s]
[1] Loading data MNLI
392702it [00:07, 50719.45it/s]
10000it [00:00, 61434.57it/s]
10000it [00:00, 60510.07it/s]
9796it [00:00, 57942.87it/s]
9847it [00:00, 56161.09it/s]
../data/shared.jsonl
Traceback (most recent call last):
  File "train_mnli.py", line 68, in <module>
    shared_content = load_mnli_shared_content()
  File "..../Densely-Interactive-Inference-Network/python/util/data_processing.py", line 173, in load_mnli_shared_content
    assert shared_file_exist
AssertionError

It seems like the data downloader downloads shared.json instead of shared.jsonl while the training script tries to load a .jsonl file.

Everything works fine when downloading shared.jsonl without a script.
Also you could rename shared.json (which redirects to downloading the file) to shared.jsonl in README

cannot find key 'sentence1_binary_parse_index_sequence'

Hello,
I am going through your code trying to understand the model.

in get_minibatch function there is a line

premise_vectors = fill_feature_vector_with_cropping_or_padding([dataset[i]['sentence1_binary_parse_index_sequence'][:] for i in indices], premise_pad_crop_pair, 1)

'sentence1_binary_parse_index_sequence' is supposed to be a key in train_snli list of dictionaries.

However, I cannot find where you create this key. Original snli set does not have it.

Regards,

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.