0

I'm trying to implement MASS on Fairseq for Neural Machine Translation. Following the approach here https://github.com/microsoft/MASS/tree/master/MASS-supNMT, I'm trying to preprocess both the monolingual and bilingual data. I didn't get any errors while processing monolingual data; however, I'm getting the error while doing for bilingual.

from fairseq.data.masked_lm_dictionary import MaskedLMDictionary ModuleNotFoundError: No module named 'fairseq.data.masked_lm_dictionary'

I'm using Fairseq version 0.12.2. I'm unable to figure out the reason behind the error.

2 Answers2

0

According to this file, you could use the MaskedLMDictionary as a class. To import it you can use the following code:

from fairseq.data import Dictionary

This doesn't return the error you mentioned.

Quinten
  • 35,235
  • 5
  • 20
  • 53
  • In the source code for xmasked_seq2seq, I changed from fairseq.data.masked_lm_dictionary to from fairseq.data.legacy.masked_lm_dictionary. This worked for me. – kartikeya saraswat Jul 23 '23 at 03:46
0

In the source code for xmasked_seq2seq, I changed from fairseq.data.masked_lm_dictionary to from fairseq.data.legacy.masked_lm_dictionary. This worked for me