Torchtext.vocab Vocab constructor error- no keyword specials

Hi,
I am trying to go through the tutorial on langauge translation at Language Translation with TorchText — PyTorch Tutorials 1.7.1 documentation
Running the first cell in the tutorial produces an error at this line:
return Vocab(counter, specials=[’<unk>’, ‘<pad>’, ‘<bos>’, ‘<eos>’])
init() got an unexpected keyword argument ‘specials’

I have seen the answer here but according to the answer my version is high enough:
torchtext: 1.11.0
torch: 1.10.0
python: 3.7

I also get another error later in the tutorial (this line PAD_IDX = en_vocab.stoi[’<pad>’] results in the error AttributeError: ‘Vocab’ object has no attribute ‘stoi’) so I think it may be a version issue but I can’t figure out what versions will work. Thank you for any help!

It seems the specials argument was removed in this PR.
The new usage seems to be shown in e.g. this tutorial.

1 Like

Thank you! You are correct. Using the new tutorial now.