All Projects → kaushalshetty → Structured Self Attention

kaushalshetty / Structured Self Attention

Licence: mit
A Structured Self-attentive Sentence Embedding

Programming Languages

python
139335 projects - #7 most used programming language
python3
1442 projects

Projects that are alternatives of or similar to Structured Self Attention

Image Caption Generator
A neural network to generate captions for an image using CNN and RNN with BEAM Search.
Stars: ✭ 126 (-72.55%)
Mutual labels:  attention-mechanism, attention, attention-model
visualization
a collection of visualization function
Stars: ✭ 189 (-58.82%)
Mutual labels:  attention, attention-mechanism
egfr-att
Drug effect prediction using neural network
Stars: ✭ 17 (-96.3%)
Mutual labels:  classification, attention-mechanism
ntua-slp-semeval2018
Deep-learning models of NTUA-SLP team submitted in SemEval 2018 tasks 1, 2 and 3.
Stars: ✭ 79 (-82.79%)
Mutual labels:  attention, attention-mechanism
Hierarchical-Word-Sense-Disambiguation-using-WordNet-Senses
Word Sense Disambiguation using Word Specific models, All word models and Hierarchical models in Tensorflow
Stars: ✭ 33 (-92.81%)
Mutual labels:  attention, attention-mechanism
Linear-Attention-Mechanism
Attention mechanism
Stars: ✭ 27 (-94.12%)
Mutual labels:  attention, attention-mechanism
Text Classification Models Pytorch
Implementation of State-of-the-art Text Classification Models in Pytorch
Stars: ✭ 379 (-17.43%)
Mutual labels:  classification, attention
learningspoons
nlp lecture-notes and source code
Stars: ✭ 29 (-93.68%)
Mutual labels:  attention, attention-model
NTUA-slp-nlp
💻Speech and Natural Language Processing (SLP & NLP) Lab Assignments for ECE NTUA
Stars: ✭ 19 (-95.86%)
Mutual labels:  attention, attention-mechanism
Pytorch Original Transformer
My implementation of the original transformer model (Vaswani et al.). I've additionally included the playground.py file for visualizing otherwise seemingly hard concepts. Currently included IWSLT pretrained models.
Stars: ✭ 411 (-10.46%)
Mutual labels:  attention-mechanism, attention
attention-mechanism-keras
attention mechanism in keras, like Dense and RNN...
Stars: ✭ 19 (-95.86%)
Mutual labels:  attention-mechanism, attention-model
Neural sp
End-to-end ASR/LM implementation with PyTorch
Stars: ✭ 408 (-11.11%)
Mutual labels:  attention-mechanism, attention
CrabNet
Predict materials properties using only the composition information!
Stars: ✭ 57 (-87.58%)
Mutual labels:  attention, attention-mechanism
datastories-semeval2017-task6
Deep-learning model presented in "DataStories at SemEval-2017 Task 6: Siamese LSTM with Attention for Humorous Text Comparison".
Stars: ✭ 20 (-95.64%)
Mutual labels:  attention, attention-mechanism
Compact-Global-Descriptor
Pytorch implementation of "Compact Global Descriptor for Neural Networks" (CGD).
Stars: ✭ 22 (-95.21%)
Mutual labels:  attention-mechanism, attention-model
automatic-personality-prediction
[AAAI 2020] Modeling Personality with Attentive Networks and Contextual Embeddings
Stars: ✭ 43 (-90.63%)
Mutual labels:  attention, attention-mechanism
Seq2seq Summarizer
Pointer-generator reinforced seq2seq summarization in PyTorch
Stars: ✭ 306 (-33.33%)
Mutual labels:  attention-mechanism, attention
reasoning attention
Unofficial implementation algorithms of attention models on SNLI dataset
Stars: ✭ 34 (-92.59%)
Mutual labels:  attention, attention-model
h-transformer-1d
Implementation of H-Transformer-1D, Hierarchical Attention for Sequence Learning
Stars: ✭ 121 (-73.64%)
Mutual labels:  attention, attention-mechanism
AoA-pytorch
A Pytorch implementation of Attention on Attention module (both self and guided variants), for Visual Question Answering
Stars: ✭ 33 (-92.81%)
Mutual labels:  attention, attention-mechanism

Structured Self-attentive sentence embeddings

Implementation for the paper A Structured Self-Attentive Sentence Embedding, which was published in ICLR 2017: https://arxiv.org/abs/1703.03130 .

USAGE:

For binary sentiment classification on imdb dataset run : python classification.py "binary"

For multiclass classification on reuters dataset run : python classification.py "multiclass"

You can change the model parameters in the model_params.json file Other tranining parameters like number of attention hops etc can be configured in the config.json file.

If you want to use pretrained glove embeddings , set the use_embeddings parameter to "True" ,default is set to False. Do not forget to download the glove.6B.50d.txt and place it in the glove folder.

Implemented:

  • Classification using self attention
  • Regularization using Frobenius norm
  • Gradient clipping
  • Visualizing the attention weights

Instead of pruning ,used averaging over the sentence embeddings.

Visualization:

After training, the model is tested on 100 test points. Attention weights for the 100 test data are retrieved and used to visualize over the text using heatmaps. A file visualization.html gets saved in the visualization/ folder after successful training. The visualization code was provided by Zhouhan Lin (@hantek). Many thanks.

Below is a shot of the visualization on few datapoints. alt text

Training accuracy 93.4% Tested on 1000 points with 90.2% accuracy


Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].