Skip to content

Point text_classification.DATASETS to local functions #775

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 15, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions torchtext/experimental/datasets/text_classification.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import torch
from torchtext.data.utils import get_tokenizer
from torchtext.vocab import build_vocab_from_iterator
from torchtext.experimental.datasets import raw
from torchtext.experimental.datasets.raw import text_classification as raw


def vocab_func(vocab):
Expand Down Expand Up @@ -98,7 +98,7 @@ def _setup_datasets(dataset_name, root='.data', ngrams=1, vocab=None,
data_select = [data_select]
if not set(data_select).issubset(set(('train', 'test'))):
raise TypeError('Given data selection {} is not supported!'.format(data_select))
train, test = DATASETS[dataset_name](root=root)
train, test = raw.DATASETS[dataset_name](root=root)
# Cache raw text iterable dataset
raw_data = {'train': [(label, txt) for (label, txt) in train],
'test': [(label, txt) for (label, txt) in test]}
Expand Down Expand Up @@ -509,15 +509,15 @@ def IMDB(*args, **kwargs):


DATASETS = {
'AG_NEWS': raw.AG_NEWS,
'SogouNews': raw.SogouNews,
'DBpedia': raw.DBpedia,
'YelpReviewPolarity': raw.YelpReviewPolarity,
'YelpReviewFull': raw.YelpReviewFull,
'YahooAnswers': raw.YahooAnswers,
'AmazonReviewPolarity': raw.AmazonReviewPolarity,
'AmazonReviewFull': raw.AmazonReviewFull,
'IMDB': raw.IMDB
'AG_NEWS': AG_NEWS,
'SogouNews': SogouNews,
'DBpedia': DBpedia,
'YelpReviewPolarity': YelpReviewPolarity,
'YelpReviewFull': YelpReviewFull,
'YahooAnswers': YahooAnswers,
'AmazonReviewPolarity': AmazonReviewPolarity,
'AmazonReviewFull': AmazonReviewFull,
'IMDB': IMDB
}


Expand Down