Text utilities and datasets for PyTorch
Project description
torchtext
This repository consists of:
torchtext.datasets: The raw text iterators for common NLP datasets
torchtext.data: Some basic NLP building blocks
torchtext.transforms: Basic text-processing transformations
torchtext.models: Pre-trained models
torchtext.vocab: Vocab and Vectors related classes and factory functions
examples: Example NLP workflows with PyTorch and torchtext library.
Installation
We recommend Anaconda as a Python package management system. Please refer to pytorch.org for the details of PyTorch installation. The following are the corresponding torchtext versions and supported Python versions.
PyTorch version |
torchtext version |
Supported Python version |
---|---|---|
nightly build |
main |
>=3.7, <=3.10 |
1.12.0 |
0.13.0 |
>=3.7, <=3.10 |
1.11.0 |
0.12.0 |
>=3.6, <=3.9 |
1.10.0 |
0.11.0 |
>=3.6, <=3.9 |
1.9.1 |
0.10.1 |
>=3.6, <=3.9 |
1.9 |
0.10 |
>=3.6, <=3.9 |
1.8.2 (LTS) |
0.9.2 (LTS) |
>=3.6, <=3.9 |
1.8.1 |
0.9.1 |
>=3.6, <=3.9 |
1.8 |
0.9 |
>=3.6, <=3.9 |
1.7.1 |
0.8.1 |
>=3.6, <=3.9 |
1.7 |
0.8 |
>=3.6, <=3.8 |
1.6 |
0.7 |
>=3.6, <=3.8 |
1.5 |
0.6 |
>=3.5, <=3.8 |
1.4 |
0.5 |
2.7, >=3.5, <=3.8 |
0.4 and below |
0.2.3 |
2.7, >=3.5, <=3.8 |
Using conda:
conda install -c pytorch torchtext
Using pip:
pip install torchtext
Note LTS versions are distributed through a different channel than the other versioned releases. Please refer to https://pytorch.org/get-started/locally/ for details.
Optional requirements
If you want to use English tokenizer from SpaCy, you need to install SpaCy and download its English model:
pip install spacy python -m spacy download en_core_web_sm
Alternatively, you might want to use the Moses tokenizer port in SacreMoses (split from NLTK). You have to install SacreMoses:
pip install sacremoses
For torchtext 0.5 and below, sentencepiece:
conda install -c powerai sentencepiece
Building from source
To build torchtext from source, you need git, CMake and C++11 compiler such as g++.:
git clone https://github.com/pytorch/text torchtext cd torchtext git submodule update --init --recursive # Linux python setup.py clean install # OSX CC=clang CXX=clang++ python setup.py clean install # or ``python setup.py develop`` if you are making modifications.
Note
When building from source, make sure that you have the same C++ compiler as the one used to build PyTorch. A simple way is to build PyTorch from source and use the same environment to build torchtext. If you are using the nightly build of PyTorch, checkout the environment it was built with conda (here) and pip (here).
Documentation
Find the documentation here.
Datasets
The datasets module currently contains:
Language modeling: WikiText2, WikiText103, PennTreebank, EnWik9
Machine translation: IWSLT2016, IWSLT2017, Multi30k
Sequence tagging (e.g. POS/NER): UDPOS, CoNLL2000Chunking
Question answering: SQuAD1, SQuAD2
Text classification: SST2, AG_NEWS, SogouNews, DBpedia, YelpReviewPolarity, YelpReviewFull, YahooAnswers, AmazonReviewPolarity, AmazonReviewFull, IMDB
Model pre-training: CC-100
Models
The library currently consist of following pre-trained models:
RoBERTa: Base and Large Architecture
XLM-RoBERTa: Base and Large Architure
Tokenizers
The transforms module currently support following scriptable tokenizers:
Tutorials
To get started with torchtext, users may refer to the following tutorial available on PyTorch website.
Disclaimer on Datasets
This is a utility library that downloads and prepares public datasets. We do not host or distribute these datasets, vouch for their quality or fairness, or claim that you have license to use the dataset. It is your responsibility to determine whether you have permission to use the dataset under the dataset’s license.
If you’re a dataset owner and wish to update any part of it (description, citation, etc.), or do not want your dataset to be included in this library, please get in touch through a GitHub issue. Thanks for your contribution to the ML community!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
File details
Details for the file torchtext-0.14.1-cp310-cp310-win_amd64.whl
.
File metadata
- Download URL: torchtext-0.14.1-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 1.9 MB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/3.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 52c1aae6626ed626b4bec65cebeb2fdf909395e2664d1ee0d79492eeb3513490 |
|
MD5 | 772ce02a0ff058b35cf4f4e083a5c4cd |
|
BLAKE2b-256 | 41bd0a7790b97a5e771d7f6a97296656aaf27fff1f764dda4d6dc6af9f23ef07 |
Provenance
File details
Details for the file torchtext-0.14.1-cp310-cp310-manylinux2014_aarch64.whl
.
File metadata
- Download URL: torchtext-0.14.1-cp310-cp310-manylinux2014_aarch64.whl
- Upload date:
- Size: 1.9 MB
- Tags: CPython 3.10
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/3.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3516a1e49c1ce33e19d35f4a1e7ba9fb89d033b057508fc889b4023b03a58c02 |
|
MD5 | 634ab43c5d8b0fe47f0ad1ba2b56b299 |
|
BLAKE2b-256 | 48729be5edbee5cc3c3b765ed470d00387f2cf1c1734ec74b944aa35274fe983 |
Provenance
File details
Details for the file torchtext-0.14.1-cp310-cp310-manylinux1_x86_64.whl
.
File metadata
- Download URL: torchtext-0.14.1-cp310-cp310-manylinux1_x86_64.whl
- Upload date:
- Size: 2.0 MB
- Tags: CPython 3.10
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/3.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bfe3e60f56580c0137531e9a0c7166298fc7f100664208a4cad4a354d9736e5f |
|
MD5 | 320b9ab6552c8a831284c89c102b9ae6 |
|
BLAKE2b-256 | 60d4ca7040169bdc129908ddf9fceeb6935ff81d09cf1105aad95ca20d6df704 |
Provenance
File details
Details for the file torchtext-0.14.1-cp310-cp310-macosx_12_0_arm64.whl
.
File metadata
- Download URL: torchtext-0.14.1-cp310-cp310-macosx_12_0_arm64.whl
- Upload date:
- Size: 2.1 MB
- Tags: CPython 3.10, macOS 12.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/3.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 65f3ea8915bf2f3797d604721a01aa9eb787afe0df33fe5acdf8e11c17eb6011 |
|
MD5 | 9d60c7e94c62db5149bdc6f8d1df5458 |
|
BLAKE2b-256 | 19a2ec574a46d268ebe6ad8fde542224d378c2eeb6bd67242fdd858d805caa08 |
Provenance
File details
Details for the file torchtext-0.14.1-cp310-cp310-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: torchtext-0.14.1-cp310-cp310-macosx_10_9_x86_64.whl
- Upload date:
- Size: 1.8 MB
- Tags: CPython 3.10, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/3.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 506bda24d28cf2447c0d89cb77a914abb3fbad312b58646caa8c918237e58a2f |
|
MD5 | 5e3dad513e4d561b0cf6297357379e70 |
|
BLAKE2b-256 | a14adfaa251c347deccaf630373e429ae8d368136a5fc4bcea6eb697878b074b |
Provenance
File details
Details for the file torchtext-0.14.1-cp39-cp39-win_amd64.whl
.
File metadata
- Download URL: torchtext-0.14.1-cp39-cp39-win_amd64.whl
- Upload date:
- Size: 1.9 MB
- Tags: CPython 3.9, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/3.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 82e5df4a7ad828d3f828b19f563993656ea1b31b4e828a22f1905b1f17faefdd |
|
MD5 | 7ce8e3776b995f85ecbae77b1e3fdff5 |
|
BLAKE2b-256 | 4279180c0923c12352ac5405d50ef7d40d7ab9d12d76c8f17cdfbff8b1a76389 |
Provenance
File details
Details for the file torchtext-0.14.1-cp39-cp39-manylinux2014_aarch64.whl
.
File metadata
- Download URL: torchtext-0.14.1-cp39-cp39-manylinux2014_aarch64.whl
- Upload date:
- Size: 1.9 MB
- Tags: CPython 3.9
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/3.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e592d9a3288859cb9af3950581c6441dfaf3d248c03e720123a382188857d6be |
|
MD5 | 46d93baae5435d98b9e8f6ee5106243b |
|
BLAKE2b-256 | 227a8c3d3207b008a8ed796a8f8dfa6daec8068728ccb521b769467e71feb4e2 |
Provenance
File details
Details for the file torchtext-0.14.1-cp39-cp39-manylinux1_x86_64.whl
.
File metadata
- Download URL: torchtext-0.14.1-cp39-cp39-manylinux1_x86_64.whl
- Upload date:
- Size: 2.0 MB
- Tags: CPython 3.9
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/3.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 93bcd73c9c58353a3caf880a11a7d95b9832a129aaee3bd30ba49e690a278f47 |
|
MD5 | 5ad1989e4990f4f797f62e25ceafb445 |
|
BLAKE2b-256 | 2ee741edc56409011ff3037961b01f6dfd8ea704798816e7196d4e9bf480d7e8 |
Provenance
File details
Details for the file torchtext-0.14.1-cp39-cp39-macosx_12_0_arm64.whl
.
File metadata
- Download URL: torchtext-0.14.1-cp39-cp39-macosx_12_0_arm64.whl
- Upload date:
- Size: 2.1 MB
- Tags: CPython 3.9, macOS 12.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/3.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8e6ec13244074c55fa8a762414bed34ba04f4d577a061e4da85fb7a1e063fd56 |
|
MD5 | 43c1ce55020256afabecf9d5b43b0504 |
|
BLAKE2b-256 | 4e7063e5a91040a165c69eb460ed6486385065e8be54b3ffd4ee51fd596802f8 |
Provenance
File details
Details for the file torchtext-0.14.1-cp39-cp39-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: torchtext-0.14.1-cp39-cp39-macosx_10_9_x86_64.whl
- Upload date:
- Size: 1.8 MB
- Tags: CPython 3.9, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/3.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0ebdf3058af4394c2602cc62380e25830fa4de60d1c81ecb96a610a51e9db80d |
|
MD5 | 349efdbf8306f373ef6dd6b80d4c1f85 |
|
BLAKE2b-256 | 146a2cfb39d01e9cc729379248aa9e94cb61f45cc58fa9fbb98a3f942a0538ef |
Provenance
File details
Details for the file torchtext-0.14.1-cp38-cp38-win_amd64.whl
.
File metadata
- Download URL: torchtext-0.14.1-cp38-cp38-win_amd64.whl
- Upload date:
- Size: 1.9 MB
- Tags: CPython 3.8, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/3.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cb5b3664c24b3b13030b61b739bdbaafde7840091cbd08b89d2f319585e70363 |
|
MD5 | d0a65e38280d69b4bd43d7bd25d22118 |
|
BLAKE2b-256 | 0963ef61e97eb21e4ad3f27abb7ca31ca87265df08da711f35c764902c74020d |
Provenance
File details
Details for the file torchtext-0.14.1-cp38-cp38-manylinux2014_aarch64.whl
.
File metadata
- Download URL: torchtext-0.14.1-cp38-cp38-manylinux2014_aarch64.whl
- Upload date:
- Size: 1.9 MB
- Tags: CPython 3.8
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/3.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2a523bee4c0e6b9e3ea68d206bcae1d7c13504c819f1ae267e6d900bd08a0d5a |
|
MD5 | 93d7b62afe9053b55b2da7b672bd4f09 |
|
BLAKE2b-256 | 88089cea391ea6e57388e6564d335c6cc172fcb746b5ca582c5e375674dc94b3 |
Provenance
File details
Details for the file torchtext-0.14.1-cp38-cp38-manylinux1_x86_64.whl
.
File metadata
- Download URL: torchtext-0.14.1-cp38-cp38-manylinux1_x86_64.whl
- Upload date:
- Size: 2.0 MB
- Tags: CPython 3.8
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/3.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ca60d46e084d431d16473d81a789010aa19d51b7b6ec868b600397409c2d9939 |
|
MD5 | 00073c271f123777a1396efd8ce5ce6b |
|
BLAKE2b-256 | fe690bed8a4125fda810c5c93893d1b9c368eb5dcba221d946998c8ecf1c8f4a |
Provenance
File details
Details for the file torchtext-0.14.1-cp38-cp38-macosx_12_0_arm64.whl
.
File metadata
- Download URL: torchtext-0.14.1-cp38-cp38-macosx_12_0_arm64.whl
- Upload date:
- Size: 2.1 MB
- Tags: CPython 3.8, macOS 12.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/3.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fb5f39656281957b20affe4172cd596ccf7d2a7c9e28677b06231c018fe83a26 |
|
MD5 | ecbb1c646bbe72daa0fda2d9440288e3 |
|
BLAKE2b-256 | cf73749b1a56d99385c9ed192774f98ab9ce23d20c329cc2a6ab5305655693fc |
Provenance
File details
Details for the file torchtext-0.14.1-cp38-cp38-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: torchtext-0.14.1-cp38-cp38-macosx_10_9_x86_64.whl
- Upload date:
- Size: 1.8 MB
- Tags: CPython 3.8, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/3.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0e5d8c837c408630a31009e4b76748fd381f369331670d638c19fbb3695fd997 |
|
MD5 | 30db1b5abe901b2cfec382dc3b7f22a5 |
|
BLAKE2b-256 | 238e2884ea246f10b432f3e311463a60a0c3b2fcfcefb30192a464337ffbc9fa |
Provenance
File details
Details for the file torchtext-0.14.1-cp37-cp37m-win_amd64.whl
.
File metadata
- Download URL: torchtext-0.14.1-cp37-cp37m-win_amd64.whl
- Upload date:
- Size: 1.9 MB
- Tags: CPython 3.7m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/3.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 15d83cf0bf07cc864e2656ee322b2b51d4a7fe00a94c9fc8f40128b3dd992004 |
|
MD5 | 6a3ae41eab2d0cd9048d3887daf54fae |
|
BLAKE2b-256 | 72ccd75305921b5d389ee318d5c18ff919406005fe5927d6514081376c3fa3e1 |
Provenance
File details
Details for the file torchtext-0.14.1-cp37-cp37m-manylinux2014_aarch64.whl
.
File metadata
- Download URL: torchtext-0.14.1-cp37-cp37m-manylinux2014_aarch64.whl
- Upload date:
- Size: 1.9 MB
- Tags: CPython 3.7m
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/3.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3f04625e0afe7d890c95c2f68e758b6e86a5c7db58dcfd8e208b03ec3dd5f561 |
|
MD5 | cf250e16b8f28c4b0791e110a7f74b32 |
|
BLAKE2b-256 | 7304767e92723646a19c3377c293305c019244fdfde05de229bd1e77e0a79147 |
Provenance
File details
Details for the file torchtext-0.14.1-cp37-cp37m-manylinux1_x86_64.whl
.
File metadata
- Download URL: torchtext-0.14.1-cp37-cp37m-manylinux1_x86_64.whl
- Upload date:
- Size: 2.0 MB
- Tags: CPython 3.7m
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/3.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 86f80a860c7d19e2c78e226334d8efc3b210946c834a8058ccc691b452be0a34 |
|
MD5 | e2470ff07e02a096f85f00014d1b40e2 |
|
BLAKE2b-256 | aeb8a580c2eed03fdb24155608e2fede323677db45a2b51d7f52518de3e709e4 |
Provenance
File details
Details for the file torchtext-0.14.1-cp37-cp37m-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: torchtext-0.14.1-cp37-cp37m-macosx_10_9_x86_64.whl
- Upload date:
- Size: 1.8 MB
- Tags: CPython 3.7m, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/3.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8c976fd2ab0388e9d3fca797614225faf2fcafff76f671bd27032be3d4b36289 |
|
MD5 | 87063a69501a378cd3ca56389d8dddf8 |
|
BLAKE2b-256 | b9b005bbdbe82093ebaef29c0f9d96a3e2e7f987300f545757aae87228ac9bd2 |