{"id":20164859,"url":"https://github.com/bentrevett/pytorch-pos-tagging","last_synced_at":"2025-09-02T06:34:29.939Z","repository":{"id":91124478,"uuid":"209280829","full_name":"bentrevett/pytorch-pos-tagging","owner":"bentrevett","description":"A tutorial on how to implement models for part-of-speech tagging using PyTorch and TorchText.","archived":false,"fork":false,"pushed_at":"2021-06-04T11:37:11.000Z","size":180,"stargazers_count":179,"open_issues_count":6,"forks_count":27,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-08T23:22:21.792Z","etag":null,"topics":["cnn","lstm","natural-language-processing","part-of-speech-tagger","pos","pos-tagging","pytorch","pytorch-implementation","pytorch-nlp","pytorch-tutorial","pytorch-tutorials","recurrent-neural-networks","rnn","torchtext","tutorial","tutorials"],"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}},"created_at":"2019-09-18T10:26:15.000Z","updated_at":"2025-04-03T20:27:05.000Z","dependencies_parsed_at":"2023-10-20T18:22:28.175Z","dependency_job_id":null,"html_url":"https://github.com/bentrevett/pytorch-pos-tagging","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bentrevett/pytorch-pos-tagging","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bentrevett%2Fpytorch-pos-tagging","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bentrevett%2Fpytorch-pos-tagging/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bentrevett%2Fpytorch-pos-tagging/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bentrevett%2Fpytorch-pos-tagging/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bentrevett","download_url":"https://codeload.github.com/bentrevett/pytorch-pos-tagging/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bentrevett%2Fpytorch-pos-tagging/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271590425,"owners_count":24786221,"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-08-22T02:00:08.480Z","response_time":65,"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":["cnn","lstm","natural-language-processing","part-of-speech-tagger","pos","pos-tagging","pytorch","pytorch-implementation","pytorch-nlp","pytorch-tutorial","pytorch-tutorials","recurrent-neural-networks","rnn","torchtext","tutorial","tutorials"],"created_at":"2024-11-14T00:35:55.674Z","updated_at":"2025-08-22T05:32:26.468Z","avatar_url":"https://github.com/bentrevett.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PyTorch PoS Tagging\n\n## Note: This repo only works with torchtext 0.9 or above which requires PyTorch 1.8 or above. If you are using torchtext 0.8 then please use [this](https://github.com/bentrevett/pytorch-pos-tagging/tree/torchtext08) branch\n\nThis repo contains tutorials covering how to perform part-of-speech (PoS) tagging using [PyTorch](https://github.com/pytorch/pytorch) 1.8, [torchtext](https://github.com/pytorch/text) 0.9, and and [spaCy](https://spacy.io/) 3.0, using Python 3.8.\n\nThese tutorials will cover getting started with the most common approach to PoS tagging: recurrent neural networks (RNNs). The first notebook introduces a bi-directional LSTM (BiLSTM) network. The second covers how to fine-tune a pretrained Transformer model.\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-pos-tagging/issues/new). I welcome any feedback, positive or negative!**\n\n## Getting Started\n\nTo install PyTorch, see installation instructions on the [PyTorch website](pytorch.org).\n\nTo install TorchText:\n\n``` bash\npip install torchtext\n```\n\nTo install the transformers library:\n\n```bash\npip install transformers\n```\n\nWe'll also make use of spaCy to tokenize our data. To install spaCy, follow the instructions [here](https://spacy.io/usage/) making sure to install the English models:\n\n``` bash\npython -m spacy download en_core_web_sm\n```\n\n## Tutorials\n\n* 1 - [BiLSTM for PoS Tagging](https://github.com/bentrevett/pytorch-pos-tagging/blob/master/1_bilstm.ipynb)[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/bentrevett/pytorch-pos-tagging/blob/master/1_bilstm.ipynb)\n\n    This tutorial covers the workflow of a PoS tagging project with PyTorch and TorchText. We'll introduce the basic TorchText concepts such as: defining how data is processed; using TorchText's datasets and how to use pre-trained embeddings. Using PyTorch we built a strong baseline model: a multi-layer bi-directional LSTM. We also show how the model can be used for inference to tag any input text.\n\n* 2 - [Fine-tuning Pretrained Transformers for PoS Tagging](https://github.com/bentrevett/pytorch-pos-tagging/blob/master/2_transformer.ipynb)[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/bentrevett/pytorch-pos-tagging/blob/master/2_transformer.ipynb)\n\n    This tutorial covers how to fine-tune a pretrained Transformer model, provided by the `transformers` library, by integrating it with TorchText. We use a pretrained BERT model to provide the embeddings for our input text and input these embeddings to a linear layer that will predict tags based on these embeddings.\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* https://github.com/pytorch/text/blob/master/torchtext/datasets/sequence_tagging.py\n* https://github.com/pytorch/text/blob/master/test/sequence_tagging.py\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbentrevett%2Fpytorch-pos-tagging","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbentrevett%2Fpytorch-pos-tagging","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbentrevett%2Fpytorch-pos-tagging/lists"}