4794be6f7e3827228b6e0dc9b1cfe432a3ecdeb3,beginner_source/text_sentiment_ngrams_tutorial.py,,,#,44

Before Change


import os
if not os.path.isdir("./.data"):
	os.mkdir("./.data")
train_dataset, test_dataset = text_classification.DATASETS["AG_NEWS"](
    root="./.data", ngrams=NGRAMS, vocab=None)
BATCH_SIZE = 16
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")

After Change


counter = Counter()
for (label, line) in train_iter:
    counter.update(tokenizer(line))
vocab = Vocab(counter, min_freq=1)


////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// The vocabulary block converts a list of tokens into integers.
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 3

Instances


Project Name: pytorch/tutorials
Commit Name: 4794be6f7e3827228b6e0dc9b1cfe432a3ecdeb3
Time: 2021-03-04
Author: brianjo@fb.com
File Name: beginner_source/text_sentiment_ngrams_tutorial.py
Class Name:
Method Name:


Project Name: RaRe-Technologies/gensim
Commit Name: 78fea7f6e759aef25811f5e987ea5b801be9ee41
Time: 2015-07-05
Author: radimrehurek@seznam.cz
File Name: gensim/models/word2vec.py
Class Name: Word2Vec
Method Name: scale_vocab


Project Name: RaRe-Technologies/gensim
Commit Name: ae243b31f370afbb95e185802295660fb8381b87
Time: 2015-07-06
Author: radimrehurek@seznam.cz
File Name: gensim/models/word2vec.py
Class Name: Word2Vec
Method Name: scale_vocab


Project Name: pytorch/tutorials
Commit Name: 4794be6f7e3827228b6e0dc9b1cfe432a3ecdeb3
Time: 2021-03-04
Author: brianjo@fb.com
File Name: beginner_source/transformer_tutorial.py
Class Name:
Method Name: