{"id":13711440,"url":"https://github.com/AnubhavGupta3377/Text-Classification-Models-Pytorch","last_synced_at":"2025-05-06T20:33:11.980Z","repository":{"id":54576134,"uuid":"159024613","full_name":"AnubhavGupta3377/Text-Classification-Models-Pytorch","owner":"AnubhavGupta3377","description":"Implementation of State-of-the-art Text Classification Models in Pytorch","archived":false,"fork":false,"pushed_at":"2019-01-05T13:53:18.000Z","size":12921,"stargazers_count":489,"open_issues_count":3,"forks_count":134,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-03-21T20:25:43.452Z","etag":null,"topics":["attention","classification","convolutional-neural-networks","deep-learning","fasttext","nlp","pytorch","rcnn","recurrent-neural-networks","seq2seq","transformer"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AnubhavGupta3377.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-11-25T11:29:48.000Z","updated_at":"2025-03-19T20:05:20.000Z","dependencies_parsed_at":"2022-08-13T20:20:10.236Z","dependency_job_id":null,"html_url":"https://github.com/AnubhavGupta3377/Text-Classification-Models-Pytorch","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnubhavGupta3377%2FText-Classification-Models-Pytorch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnubhavGupta3377%2FText-Classification-Models-Pytorch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnubhavGupta3377%2FText-Classification-Models-Pytorch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnubhavGupta3377%2FText-Classification-Models-Pytorch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AnubhavGupta3377","download_url":"https://codeload.github.com/AnubhavGupta3377/Text-Classification-Models-Pytorch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252764799,"owners_count":21800748,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["attention","classification","convolutional-neural-networks","deep-learning","fasttext","nlp","pytorch","rcnn","recurrent-neural-networks","seq2seq","transformer"],"created_at":"2024-08-02T23:01:08.187Z","updated_at":"2025-05-06T20:33:08.388Z","avatar_url":"https://github.com/AnubhavGupta3377.png","language":"Python","funding_links":[],"categories":["Repository \u0026 Tool"],"sub_categories":["Weakly-supervised \u0026 Semi-supervised Learning"],"readme":"# Text-Classification-Models-Pytorch\nImplementation of State-of-the-art Text Classification Models in Pytorch\n\n## Implemented Models\n- **fastText:** fastText Model from [Bag of Tricks for Efficient Text Classification](https://arxiv.org/abs/1607.01759)\n- **TextCNN:** CNN for text classification proposed in [Convolutional Neural Networks for Sentence Classification](https://arxiv.org/abs/1408.5882)\n- **TextRNN:** Bi-direction LSTM network for text classification\n- **RCNN:** Implementation of RCNN Model proposed in [Recurrent Convolutional Neural Networks for Text Classification](https://www.aaai.org/ocs/index.php/AAAI/AAAI15/paper/download/9745/9552)\n- **CharCNN:** Implementation of character-level CNNs as proposed in the paper [Character-level Convolutional Networks for Text Classification](https://papers.nips.cc/paper/5782-character-level-convolutional-networks-for-text-classification.pdf)\n- **Seq2seq With Attention:** Implementation of seq2seq model with attention from [Neural Machine Translation by Jointly Learning to Align and Translate](https://arxiv.org/pdf/1409.0473.pdf), [Text Classification Research with Attention-based Recurrent Neural Networks](http://univagora.ro/jour/index.php/ijccc/article/download/3142/pdf)\n- **Transformer:** Implementation of Transformer model proposed in [Attention Is All You Need](https://arxiv.org/abs/1706.03762)\n\n## Requirements\n- Python-3.5.0\n- Pandas-0.23.4\n- Numpy-1.15.2\n- Spacy-2.0.13\n- Pytorch-0.4.1.post2\n- Torchtext-0.3.1\n\n## Usage\n1) Download data into \"data/\" directory or use already available data\n2) If using your own data, convert it into the same format as of provided data \n3) Download Pre-trained word embeddings (Glove/Word2Vec) into \"data/\" directory\n4) Go to corresponding model directory\n5) run following command:\n\npython train.py \u003cpath_to_training_file\u003e \u003cpath_to_test_file\u003e\n\n## Model Performance\n- All the models were run on a 14GB machine with 2 Cores and one NVIDIA Tesla K80 GPU.\n- Runtime in the table below includes the time to load and process the data and running the model.\n- Model parameters are not tuned. So, better performance can be achieved by some parameter tuning.\n\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003cth rowspan=\"3\"\u003eModel\u003c/th\u003e\n    \u003cth align=\"center\" colspan=\"4\"\u003eDataset\u003c/th\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003cth colspan=\"2\"\u003eAG_News\u003c/th\u003e\n    \u003cth colspan=\"2\"\u003eQuery_Well_formedness\u003c/th\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003cth\u003eAccuracy (%)\u003c/th\u003e\n    \u003cth\u003eRuntime \u003c/th\u003e\n    \u003cth\u003eAccuracy (%)\u003c/th\u003e\n    \u003cth\u003eRuntime \u003c/th\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003efastText\u003c/td\u003e\n    \u003ctd\u003e89.46\u003c/td\u003e\n    \u003ctd\u003e16.0 Mins\u003c/td\u003e\n    \u003ctd\u003e62.10\u003c/td\u003e\n    \u003ctd\u003e7.0 Mins\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003eTextCNN\u003c/td\u003e\n    \u003ctd\u003e88.57\u003c/td\u003e\n    \u003ctd\u003e17.2 Mins\u003c/td\u003e\n    \u003ctd\u003e67.38\u003c/td\u003e\n    \u003ctd\u003e7.43 Mins\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003eTextRNN\u003c/td\u003e\n    \u003ctd\u003e88.07 (Seq len = 20) \u003cbr/\u003e 90.43 (Flexible seq len)\u003c/td\u003e\n    \u003ctd\u003e21.5 Mins \u003cbr/\u003e 36.8 Mins\u003c/td\u003e\n    \u003ctd\u003e68.29 \u003cbr/\u003e 66.29\u003c/td\u003e\n    \u003ctd\u003e7.69 Mins \u003cbr/\u003e 7.25 Mins\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003eRCNN\u003c/td\u003e\n    \u003ctd\u003e90.61\u003c/td\u003e\n    \u003ctd\u003e22.73 Mins\u003c/td\u003e\n    \u003ctd\u003e66.70\u003c/td\u003e\n    \u003ctd\u003e7.21 Mins\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003eCharCNN\u003c/td\u003e\n    \u003ctd\u003e87.70\u003c/td\u003e\n    \u003ctd\u003e13.08 Mins\u003c/td\u003e\n    \u003ctd\u003e68.83\u003c/td\u003e\n    \u003ctd\u003e2.49 Mins\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003eSeq2Seq_Attention\u003c/td\u003e\n    \u003ctd\u003e90.26\u003c/td\u003e\n    \u003ctd\u003e19.10 Mins\u003c/td\u003e\n    \u003ctd\u003e67.84\u003c/td\u003e\n    \u003ctd\u003e7.36 Mins\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003eTransformer\u003c/td\u003e\n    \u003ctd\u003e88.54\u003c/td\u003e\n    \u003ctd\u003e46.47 Mins\u003c/td\u003e\n    \u003ctd\u003e63.43\u003c/td\u003e\n    \u003ctd\u003e5.77 Mins\u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n## References\n[1] [Bag of Tricks for Efficient Text Classification](https://arxiv.org/abs/1607.01759) \u003c/br\u003e\n[2] [Convolutional Neural Networks for Sentence Classification](https://arxiv.org/abs/1408.5882) \u003c/br\u003e\n[3] [Recurrent Convolutional Neural Networks for Text Classification](https://www.aaai.org/ocs/index.php/AAAI/AAAI15/paper/download/9745/9552) \u003c/br\u003e\n[4] [Character-level Convolutional Networks for Text Classification](https://papers.nips.cc/paper/5782-character-level-convolutional-networks-for-text-classification.pdf) \u003c/br\u003e\n[5] [Neural Machine Translation by Jointly Learning to Align and Translate](https://arxiv.org/pdf/1409.0473.pdf) \u003c/br\u003e\n[6] [Text Classification Research with Attention-based Recurrent Neural Networks](http://univagora.ro/jour/index.php/ijccc/article/download/3142/pdf) \u003c/br\u003e\n[7] [Attention Is All You Need](https://arxiv.org/abs/1706.03762) \u003c/br\u003e\n[8] [Rethinking the Inception Architecture for Computer Vision](https://arxiv.org/pdf/1705.03122.pdf) \u003c/br\u003e\n[9] [Identifying Well-formed Natural Language Questions](https://arxiv.org/pdf/1808.09419.pdf) \u003cbr\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAnubhavGupta3377%2FText-Classification-Models-Pytorch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FAnubhavGupta3377%2FText-Classification-Models-Pytorch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAnubhavGupta3377%2FText-Classification-Models-Pytorch/lists"}