Git Product home page Git Product logo

decomposable-attention's Introduction

Decomposable-Attention

A Tensorflow implementation of Parikh's A Decomposable Attention Model for Natural Language Inference from EMNLP 2016.

Dataset

The dataset used for this task is Stanford Natural Language Inference (SNLI). Pretrained GloVe embeddings obtained from common crawl with 840B tokens used for words.

Requirements

  • Python>=3
  • NumPy
  • TensorFlow>=1.8

Usage

Download dataset from Stanford Natural Language Inference, then move snli_1.0_train.jsonl, snli_1.0_dev.jsonl, snli_1.0_test.jsonl into ./SNLI/raw data.

# move dataset to the right place
mkdir -p ./SNLI/raw\ data
mv snli_1.0_*.jsonl ./SNLI/raw\ data

Data preprocessing for convert source data into an easy-to-use format.

python3 Utils.py

Default hyper-parameters have been stored in config file in the path of ./config/config.yaml.

Training model:

python3 Train.py

Test model:

python3 Test.py

Results

Decomposable Attention Reported Our Experiments
Accuracy 86.3% 85.4%

decomposable-attention's People

Contributors

hsiaoyetgun 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

Watchers

 avatar  avatar  avatar

decomposable-attention's Issues

error

Hi
Thank you for sharing this code when I run the code I got this error

While running python3 Train.py, I am getting the following error:

Start training and evaluating ...
Epoch : 1
Traceback (most recent call last):
File "Train.py", line 164, in
train()
File "Train.py", line 93, in train
_, batch_loss, batch_acc = sess.run([model.train, model.loss, model.acc], feed_dict=feed_dict)

Traceback (most recent call last):
File "/home/nujud/Desktop/code/Decomposable-Attention-master/Train.py", line 166, in
train()
File "/home/nujud/Desktop/code/Decomposable-Attention-master/Train.py", line 95, in train
_, batch_loss, batch_acc = sess.run([model.train, model.loss, model.acc], feed_dict=feed_dict)
File "/home/nujud/anaconda2/envs/tensorflow-cpu/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 900, in run
run_metadata_ptr)
File "/home/nujud/anaconda2/envs/tensorflow-cpu/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1111, in _run
str(subfeed_t.get_shape())))
ValueError: Cannot feed value of shape (128,) for Tensor 'premise_mask:0', which has shape '(?, 100)'

please help
Thank you in advance

Looking forward for your reply.
Thanks,

ValueError with tensor shape

Hi,

Thanks for sharing the tensorflow version of Decomp-att, this a very useful resource. I am getting a small error and would be very thankful if you can help me in solving this.

While running python3 Train.py, I am getting the following error:

Start training and evaluating ...
Epoch : 1
Traceback (most recent call last):
File "Train.py", line 164, in
train()
File "Train.py", line 93, in train
_, batch_loss, batch_acc = sess.run([model.train, model.loss, model.acc], feed_dict=feed_dict)
File "/Users/vikasy/anaconda3/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 887, in run
run_metadata_ptr)
File "/Users/vikasy/anaconda3/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1086, in _run
str(subfeed_t.get_shape())))
ValueError: Cannot feed value of shape (128,) for Tensor 'premise_mask:0', which has shape '(?, 100)'

Looking forward for your reply.
Thanks,
vikasy95

what problem?

hi
I want run project decomposble attention on google colab.
I run python3 Utils.py
output:
tcmalloc: large alloc 2635227136 bytes == 0x199672000 @ 0x7f8dd39dc001 0x7f8dd12e9b85 ...

I set batchsize=8 and reduce data.
but give me same error.

error on train and test

Traceback (most recent call last):
File "Test.py", line 96, in
predict()
File "Test.py", line 25, in predict
arg.testset_path, vocab_dict)
File "/home/ddianat/rahnema/code/Decomposable-Attention/Utils.py", line 189, in sentence2Index
labelList = enc._fit_transform(labelList)
AttributeError: 'OneHotEncoder' object has no attribute '_fit_transform'

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.