Open WhaSukGO opened 1 month ago
# AttributeError: module 'torchtext' has no attribute 'vocab' en_vocab = torchtext.vocab.build_vocab_from_iterator( train_data["en_tokens"], min_freq=min_freq, specials=special_tokens, ) de_vocab = torchtext.vocab.build_vocab_from_iterator( train_data["de_tokens"], min_freq=min_freq, specials=special_tokens, )
# Working from torchtext.vocab import build_vocab_from_iterator en_vocab = build_vocab_from_iterator( train_data["en_tokens"], min_freq=min_freq, specials=special_tokens, ) de_vocab = build_vocab_from_iterator( train_data["de_tokens"], min_freq=min_freq, specials=special_tokens, )