Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loading the model #25

Open
shravankumar33 opened this issue Aug 14, 2020 · 1 comment
Open

Loading the model #25

shravankumar33 opened this issue Aug 14, 2020 · 1 comment

Comments

@shravankumar33
Copy link

The model gets loaded every time fairseq-generate is called to get a summary. Is there any way to avoid the model loading everytime I want to do an inference? Is there any possible way to first pre-load the model and then the inference on it?
Thanks.

@ShoubhikBanerjee
Copy link

You can try Loading custom models: from this link, i.e.

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants