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.9 |
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
Hashes for torchtext-0.13.1-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5f8c1b426bda2f22e5bfd118c779c12f8612ed1077e5e3a491242bb4ab7ac4d3 |
|
MD5 | eba2a3b35a3078e47e9981346b96f5be |
|
BLAKE2b-256 | b89d7f9b786637d664579b66ae7c6742d662a91b8e6a9f55a34e22c20883d801 |
Hashes for torchtext-0.13.1-cp310-cp310-manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b5bf4f9da5326b6e74318b4a5035abfaf166b3abd822565be685f44947adb8d3 |
|
MD5 | 79791f21bc4582e6d9a2359c9b2e9f1c |
|
BLAKE2b-256 | 3ffde3eef8b5d691cdeb42506fc9fec2a64ab1549039cdf9e7545a171e4a694e |
Hashes for torchtext-0.13.1-cp310-cp310-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f56359165eb00ea2ff998b67727f87e7fa32665c1a46610c9b5a2d5d581095e5 |
|
MD5 | 8a58d31906cd5456846b7f7edaece7ee |
|
BLAKE2b-256 | 484e56352383c30b75becd5faaff8d404eb86f3a2282d72ae52aaad705bf22bf |
Hashes for torchtext-0.13.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 492a22727181edf5a33fa18587f3430ffbb366c2ea835e0f4f8a08be8d9e859c |
|
MD5 | 7776153ae735f2d12c75d7bd1a23c88c |
|
BLAKE2b-256 | 2fbd5f27d604d3dc6421b3c0bd24c28f73eecb091fce9dbdcbe7af314f252cee |
Hashes for torchtext-0.13.1-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aa59df8f9542674311fc23aca147a34256c936c25840c4b6ee3fee47d511ad17 |
|
MD5 | 7649f8c56853715561941561070b4811 |
|
BLAKE2b-256 | 106f673e3533a296f135fecfccdf2519ecfba7e16971dca5c3bc7a8cc9cfd064 |
Hashes for torchtext-0.13.1-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fdfca76d4f16f7d3fd8b93f545bf4b34e8cc01c099ee6796c49cf41da966b708 |
|
MD5 | 2be7faa662420386d4c1e8e57a7eb4ac |
|
BLAKE2b-256 | dcff0d1faa43253ffa274372f06c25c63fbfd599e7dcb0eaf3d6594dbbb1e496 |
Hashes for torchtext-0.13.1-cp39-cp39-manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1a1a8897790ea3e9276c0f0ce0afa6b7de521c265c84c1af4508439013dd68a6 |
|
MD5 | 7fe4fadab56ebb5ddcfbd81af871ca73 |
|
BLAKE2b-256 | ccd7d61fb341455fb6117b2cfa30794a26a7fc34c215c82c6cbebe590797739f |
Hashes for torchtext-0.13.1-cp39-cp39-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 32f51e4651710c8cc9e7d3e3877a5eed169100bf5539fd35bd6315e97993cf99 |
|
MD5 | 85b63155b581d8c1e5aa92bf1c0b34bb |
|
BLAKE2b-256 | f20a4524eb93fa7d95cd4f09004e14066a76a5e106c4b7293fe6e2e9e7399e68 |
Hashes for torchtext-0.13.1-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 07de89d3d3784a5821ec45427c36f4737e3092a802998afdf7bb0b1ae326d562 |
|
MD5 | e94752f98dee92e4d57a0f96b5b8dd50 |
|
BLAKE2b-256 | 1f13dbcd6dd1d916d35f3e140265bff8bf3ac2539494eb6bba4b3d30cbae51af |
Hashes for torchtext-0.13.1-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ba05716fca0bdff1c8527cfe88231ca664f236173e52209d737681e02d752e7d |
|
MD5 | e02730815969ebb7ab73748cb52f0cde |
|
BLAKE2b-256 | 3ec8486650e2b628a2b3352250293b4e8654084b6abb415e01046c822b8b87cb |
Hashes for torchtext-0.13.1-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 45cf502a91191110fbc3cf59de76818d9f2f64cf9327ee59b6bc2fe016f107ff |
|
MD5 | 75ddcff0a4ba12f49dd27651fedf146f |
|
BLAKE2b-256 | e39e0e1b780b0d60fb7672df1364efbf4755c9bbd6b18f70e0186dc8513121b7 |
Hashes for torchtext-0.13.1-cp38-cp38-manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8b6d5f7db841ac0542aa391137405a5d01770bf3e52f58945a9ec43521e8ebf7 |
|
MD5 | 89b7d76166806458899e16d8b6734bfe |
|
BLAKE2b-256 | 56311c2f6125c5fcba2d3479bf2593b01bc5b7ae40890d903e92763b5fcf2426 |
Hashes for torchtext-0.13.1-cp38-cp38-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3f84f8d3f4bdfea711111953c500d51feb6103c9be9fcef98fd471c33532f5d2 |
|
MD5 | e00d85159c05eea9f0d75575ca997885 |
|
BLAKE2b-256 | a63905bbbe8da8cba7b2b2bf71388947e08ac8161bef288b57b98505ec109159 |
Hashes for torchtext-0.13.1-cp38-cp38-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a6f186aeb4dfd74bcef2de8ef8c83a9abbdbdb2d0b149e04d5d4ae6b7059cd06 |
|
MD5 | f9ac6cf218626df102a501c369c01af3 |
|
BLAKE2b-256 | 70904a26c439a26eed6d189db095416c2812ecf920117fdd9ef2a791bc98cb7b |
Hashes for torchtext-0.13.1-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 88d7e168832037d9d65dfaee4931a0712016ed634c3feaa6f0fdc0ce1b879a61 |
|
MD5 | 610b5506d3679707222e55e189a2d969 |
|
BLAKE2b-256 | d21525ff2e3d2819f56a7f4187be56f03fa346208ed7c46bfee855992b95e3eb |
Hashes for torchtext-0.13.1-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 00602d3d40d6aa3a67c9937738ec296d706d878a1d41b3eba6597547a55e711a |
|
MD5 | 097b9ec46dc2443707766d2fd25b8675 |
|
BLAKE2b-256 | c5cfb653d6069017b572ec10ecb3ff48587cf40349b953f27bc165ed72d3423d |
Hashes for torchtext-0.13.1-cp37-cp37m-manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1588fdbc3f38b3382d7b8d4d32fecdc120ec3307a11a740a1ee499e007b82cc4 |
|
MD5 | 62cec8a3f7a07447ab7265f034a488bb |
|
BLAKE2b-256 | 8bd6f2903cdc5cbbde204ead0fe9434d9e76f768a187505771d6289dc7c8cd1f |
Hashes for torchtext-0.13.1-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | da57c857f5934b8f48a08b63af51bc48a6eed79b1beac34217b60881a0c9f289 |
|
MD5 | a4d88abe0cc6b3e54d393249385e40a9 |
|
BLAKE2b-256 | 59ea6a8c993cf968075b5aa6d57d9f541076ef8eff287eced1fbe7f3ee68e6c0 |
Hashes for torchtext-0.13.1-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e2e5af4acc8dc12784bff67560ddeaf9f3e6a2f168568b109936336bb4d25cfb |
|
MD5 | 26666a9ce41f031772c12c394c608afc |
|
BLAKE2b-256 | 4b464e478c32529e8994a7d25df569f32f6b78010db3ba3cc0004da0871cefa6 |