I am using the mass translation model based on fairseq to apply it to the Django server.Therefore, in the translation phase, I try to use the translate method for reference: fairseq/examples/translation at main · pytorch/fairseq · GitHub 1
from fairseq.models.xtransformer import XTransformerModel
zh2en = XTransformerModel.from_pretrained(
'/work/qymeng5/MASS_test/model',
checkpoint_file='model.pt',
data_name_or_path='/work/qymeng5/MASS_test/vocabulary', #Vocabulary path
bpe='subword_nmt',
bpe_codes='/work/qymeng5/MASS_test/bpe/all.zh.bpe.codes' #Chinese BPE path
)

ff=zh2en.translate('你好 世界')
print('ff',ff)

But running this code will report this error. Is it because MASS doesn’t implement the translate method, or is it my code problem？