← Open Source
EdGENetworks

attention-networks-for-classification

Hierarchical Attention Networks for Document Classification in PyTorch.

Model DevelopmentArchitectureJupyter Notebook
Open on GitHub
Momentum
+0stars in 24 hours0.0%
606
Stars
130
Forks
+0
This week
2
Contributors
Created 2017-02-24 · Updated 2026-07-21 · #16196 today
Top developers
Sandeep42ZeweiChu

EdGENetworks/attention-networks-for-classification is ranked 16,196 with 606 stars.

Same-category comparison

EdGENetworks/attention-networks-for-classification is ranked 16,196 among these 8 peers; wzdnzd/harvester is ranked 16,193.

Same-category comparison
NameRankMetrics
stefanopini/simple-HRNet16,180
Language:
Python
Stars:
608
Forks:
111
Description:
Multi-person Human Pose Estimation with HRNet in Pytorch.
theAIGuysCode/yolov4-custom-functions16,182
Language:
Python
Stars:
608
Forks:
360
Description:
A Wide Range of Custom Functions for YOLOv4, YOLOv4-tiny, YOLOv3, and YOLOv3-tiny Implemented in TensorFlow, TFLite, and TensorRT.
MishaLaskin/curl16,186
Language:
Python
Stars:
607
Forks:
92
Description:
CURL: Contrastive Unsupervised Representation Learning for Sample-Efficient Reinforcement Learning.
wzdnzd/harvester16,193
Language:
Python
Stars:
607
Forks:
136
Description:
Intelligent data acquisition framework for GitHub and web sources.
levyflux/AViD16,205
Language:
Python
Stars:
606
Forks:
95
Description:
Framework that enables fine-tuning of vision-language grounding models on custom datasets.
microsoft/CvT16,207
Language:
Python
Stars:
606
Forks:
130
Description:
This is an official implementation of CvT: Introducing Convolutions to Vision Transformers.
princeton-nlp/WebShop16,208
Language:
Python
Stars:
606
Forks:
107
Description:
[NeurIPS 2022] 🛒WebShop: Towards Scalable Real-World Web Interaction with Grounded Language Agents.
prs-eth/OverlapPredator16,209
Language:
Python
Stars:
606
Forks:
89
Description:
[CVPR 2021, Oral] PREDATOR: Registration of 3D Point Clouds with Low Overlap.
Key parameters and specifications
Key parameters and specifications
ParameterValue
LanguageJupyter Notebook
CategoryModel Development
SubcategoryArchitecture
Stars606
Forks130
Contributors2
Created date2017-02-24
Updated date2026-07-21
Stars in 1 day0
Stars in 7 days0
Rank16,196
Previous rank15,984
Rank change-212
7-day stars rank15,397
Previous 7-day stars rank15,405
7-day stars rank change8
Total stars rank16,656
Previous total stars rank16,627
Total stars rank change-29
CountryIndia
README summary

Hierarchical Attention Networks for Document Classification We know that documents have a hierarchical structure, words combine to form sentences and sentences combine to form documents. We can try to learn that structure or we can input this hierarchical structure into the model and see if it improves the performance of existing models. This paper exploits that structure to build a classification model. This is an (close) implementation of the model in PyTorch. I jointly optimize both the word and sentence

attention models with the same optimizer. This can be improved, one can sort senteces with similar length together, and minimize the paddings. ~~Pytorch does not yet support gradient masking, so padded zeros will have gradients flowing through them during backpropagation. One can create a mask, but since I am interested in using Bidirectional GRU, it is not possible to use a mask. I've seen that variable length RNN supoort is coming soon to Pytorch as well. ~~ Update: Pytorch does supoort

masked RNN now with pack_padded_sequence method. This picture from Explosion blog explains the structure perfectly. Notebook The notebook contains an example of trained model on IMDB movie review dataset. I could not get the original IMDB dataset that the paper referred to, so I have used this data The preprocessed data is available here The best accuracy that I got was around ~ 0. This dataset has only 84919 samples and 10 classes. Here is the training loss for

the dataset.

Frequently asked questions

How many stars and forks are recorded?

EdGENetworks/attention-networks-for-classification has 606 stars and 130 forks.

What is the repository rank?

EdGENetworks/attention-networks-for-classification is ranked 16,196.

What language and category are recorded?

EdGENetworks/attention-networks-for-classification has 606 stars, uses Jupyter Notebook and belongs to Model Development.

Which repository is closest in rank?

EdGENetworks/attention-networks-for-classification is compared with wzdnzd/harvester, ranked 16,193 with 607 stars.

README

Hierarchical Attention Networks for Document Classification

We know that documents have a hierarchical structure, words combine to form sentences and sentences combine to form documents. We can try to learn that structure or we can input this hierarchical structure into the model and see if it improves the performance of existing models. This paper exploits that structure to build a classification model.

This is an (close) implementation of the model in PyTorch.

Note:

  1. I jointly optimize both the word and sentence attention models with the same optimizer.
  2. The minibatches are padded with zeros. This can be improved, one can sort senteces with similar length together, and minimize the paddings.
  3. Pytorch does not yet support gradient masking, so padded zeros will have gradients flowing through them during backpropagation. One can create a mask, but since I am interested in using Bidirectional GRU, it is not possible to use a mask. I've seen that variable length RNN supoort is coming soon to Pytorch as well. Update: Pytorch does supoort masked RNN now with pack_padded_sequence method.

This picture from Explosion blog explains the structure perfectly.

Notebook

The notebook contains an example of trained model on IMDB movie review dataset. I could not get the original IMDB dataset that the paper referred to, so I have used this data

The preprocessed data is available here

The best accuracy that I got was around ~ 0.35. This dataset has only 84919 samples and 10 classes. Here is the training loss for the dataset.

Nearby in the ranking
Similar items