In the tutorial of [pytorch tutorial of language modeling]
(Language Modeling with nn.Transformer and TorchText — PyTorch Tutorials 1.9.0+cu102 documentation)
There is code of using wikitext2```
import torch
from torchtext.datasets import WikiText2
train_iter = WikiText2(split=‘train’)
It causes the error message shown as follows, which indicates that I need to set up "path" and "text_field". However, the Pytorch documents does not specify the physical meanings of these two parameters?
TypeError Traceback (most recent call last)
in
4 from torchtext.vocab import build_vocab_from_iterator
5
----> 6 train_iter = WikiText2(split=‘train’)
7 tokenizer = get_tokenizer(‘basic_english’)
8 vocab = build_vocab_from_iterator(map(tokenizer, train_iter), specials=[""])
TypeError: init() missing 2 required positional arguments: ‘path’ and ‘text_field’