{"id":13427119,"url":"https://github.com/bentrevett/pytorch-sentiment-analysis","last_synced_at":"2025-10-06T00:41:22.978Z","repository":{"id":27492577,"uuid":"114125096","full_name":"bentrevett/pytorch-sentiment-analysis","owner":"bentrevett","description":"Tutorials on getting started with PyTorch and TorchText for sentiment analysis.","archived":false,"fork":false,"pushed_at":"2024-03-27T17:27:27.000Z","size":1724,"stargazers_count":4512,"open_issues_count":4,"forks_count":1181,"subscribers_count":83,"default_branch":"main","last_synced_at":"2025-05-28T17:48:43.272Z","etag":null,"topics":["bert","cnn","cnn-text-classification","fasttext","lstm","lstm-sentiment-analysis","natural-language-processing","nlp","pytorch","pytorch-nlp","pytorch-tutorial","pytorch-tutorials","recurrent-neural-networks","rnn","sentiment-analysis","sentiment-classification","torchtext","transformers","tutorial","word-embeddings"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","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/bentrevett.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,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2017-12-13T13:36:40.000Z","updated_at":"2025-05-28T06:32:38.000Z","dependencies_parsed_at":"2022-07-10T04:00:35.512Z","dependency_job_id":"4f1b1c60-efee-4e28-b5a6-75a827d83239","html_url":"https://github.com/bentrevett/pytorch-sentiment-analysis","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bentrevett/pytorch-sentiment-analysis","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bentrevett%2Fpytorch-sentiment-analysis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bentrevett%2Fpytorch-sentiment-analysis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bentrevett%2Fpytorch-sentiment-analysis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bentrevett%2Fpytorch-sentiment-analysis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bentrevett","download_url":"https://codeload.github.com/bentrevett/pytorch-sentiment-analysis/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bentrevett%2Fpytorch-sentiment-analysis/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278542673,"owners_count":26004060,"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","status":"online","status_checked_at":"2025-10-05T02:00:06.059Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["bert","cnn","cnn-text-classification","fasttext","lstm","lstm-sentiment-analysis","natural-language-processing","nlp","pytorch","pytorch-nlp","pytorch-tutorial","pytorch-tutorials","recurrent-neural-networks","rnn","sentiment-analysis","sentiment-classification","torchtext","transformers","tutorial","word-embeddings"],"created_at":"2024-07-31T00:01:54.275Z","updated_at":"2025-10-06T00:41:22.957Z","avatar_url":"https://github.com/bentrevett.png","language":"Jupyter Notebook","funding_links":[],"categories":["Jupyter Notebook","文本分类","Tutorials \u0026 books \u0026 examples｜教程 \u0026 书籍 \u0026 示例","Tutorials, books, \u0026 examples"],"sub_categories":["大语言对话模型及数据","Other libraries｜其他库:","Other libraries:"],"readme":"# PyTorch Sentiment Analysis\n\nThis repo contains tutorials covering understanding and implementing sequence classification models using [PyTorch](https://github.com/pytorch/pytorch), with Python 3.9. Specifically, we'll train models to predict sentiment from movie reviews.\n\n**If you find any mistakes or disagree with any of the explanations, please do not hesitate to [submit an issue](https://github.com/bentrevett/pytorch-sentiment-analysis/issues/new). I welcome any feedback, positive or negative!**\n\n## Getting Started\n\nInstall the required dependencies with: `pip install -r requirements.txt --upgrade`.\n\n## Tutorials\n\n-   1 - [Neural Bag of Words](https://github.com/bentrevett/pytorch-sentiment-analysis/blob/main/1%20-%20Neural%20Bag%20of%20Words.ipynb) [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/bentrevett/pytorch-sentiment-analysis/blob/main/1%20-%20Neural%20Bag%20of%20Words.ipynb)\n\n    This tutorial covers the workflow of a sequence classification project with PyTorch. We'll cover the basics of sequence classification using a simple, but effective, neural bag-of-words model, and how to use the datasets/torchtext libaries to simplify data loading/preprocessing.\n\n-   2 - [Recurrent Neural Networks](https://github.com/bentrevett/pytorch-sentiment-analysis/blob/main/2%20-%20Recurrent%20Neural%20Networks.ipynb) [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/bentrevett/pytorch-sentiment-analysis/blob/main/2%20-%20Recurrent%20Neural%20Networks.ipynb)\n\n    Now we have the basic sequence classification workflow covered, this tutorial will focus on improving our results by switching to a recurrent neural network (RNN) model. We'll cover the theory behind RNNs, and look at an implementation of the long short-term memory (LSTM) RNN, one of the most common variants of RNN.\n\n-   3 - [Convolutional Neural Networks](https://github.com/bentrevett/pytorch-sentiment-analysis/blob/main/3%20-%20Convolutional%20Neural%20Networks.ipynb) [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/bentrevett/pytorch-sentiment-analysis/blob/main/3%20-%20Convolutional%20Neural%20Networks.ipynb)\n\n    Next, we'll cover convolutional neural networks (CNNs) for sentiment analysis. This model will be an implementation of [Convolutional Neural Networks for Sentence Classification](https://arxiv.org/abs/1408.5882).\n\n-   4 - [Transformers](https://github.com/bentrevett/pytorch-sentiment-analysis/blob/main/4%20-%20Transformers.ipynb) [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/bentrevett/pytorch-sentiment-analysis/blob/main/4%20-%20Transformers.ipynb)\n\n    Finally, we'll show how to use the transformers library to load a pre-trained transformer model, specifically the BERT model from [this](https://arxiv.org/abs/1810.04805) paper, and use it for sequence classification.\n\n## Legacy Tutorials\n\nPrevious versions of these tutorials used features from the torchtext library which are no longer available. These are stored in the [legacy](https://github.com/bentrevett/pytorch-sentiment-analysis/tree/main/legacy) directory.\n\n## References\n\nHere are some things I looked at while making these tutorials. Some of it may be out of date.\n\n-   http://anie.me/On-Torchtext/\n-   http://mlexplained.com/2018/02/08/a-comprehensive-tutorial-to-torchtext/\n-   https://github.com/spro/practical-pytorch\n-   https://gist.github.com/Tushar-N/dfca335e370a2bc3bc79876e6270099e\n-   https://gist.github.com/HarshTrivedi/f4e7293e941b17d19058f6fb90ab0fec\n-   https://github.com/keras-team/keras/blob/master/examples/imdb_fasttext.py\n-   https://github.com/Shawn1993/cnn-text-classification-pytorch\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbentrevett%2Fpytorch-sentiment-analysis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbentrevett%2Fpytorch-sentiment-analysis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbentrevett%2Fpytorch-sentiment-analysis/lists"}