Created
March 20, 2020 12:49
-
-
Save taoyds/06ff21d20703dffa17b86afa4ea01300 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from fairseq.models.transformer import TransformerModel | |
zh2en = TransformerModel.from_pretrained( | |
'/path/to/checkpoints', | |
checkpoint_file='checkpoint_best.pt', | |
data_name_or_path='data-bin/wmt17_zh_en_full', | |
bpe='subword_nmt', | |
bpe_codes='data-bin/wmt17_zh_en_full/zh.code' | |
) | |
zh2en.translate('你好 世界') | |
# 'Hello World' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment