"...git@developer.sourcefind.cn:renzhc/diffusers_dcu.git" did not exist on "d9227cf78836fffd7aec639a072e6da4d6736aa2"
Commit 7fc9a3be authored by Matt Le's avatar Matt Le Committed by Facebook Github Bot
Browse files

Create fairseq_cli_lib

Summary: This allows one to call fairseq_cli functions from within python without dispatching to bash.

Reviewed By: myleott

Differential Revision: D14404719

fbshipit-source-id: 044eb652045bb15fc40e72ecbaf6fb10df9f8c61
parent fef4e002
...@@ -11,7 +11,7 @@ Translate pre-processed data with a trained model. ...@@ -11,7 +11,7 @@ Translate pre-processed data with a trained model.
import torch import torch
from fairseq import bleu, options, progress_bar, tasks, tokenizer, utils from fairseq import bleu, options, progress_bar, tasks, utils
from fairseq.meters import StopwatchMeter, TimeMeter from fairseq.meters import StopwatchMeter, TimeMeter
from fairseq.utils import import_user_module from fairseq.utils import import_user_module
...@@ -179,6 +179,7 @@ def main(args): ...@@ -179,6 +179,7 @@ def main(args):
num_sentences, gen_timer.n, gen_timer.sum, num_sentences / gen_timer.sum, 1. / gen_timer.avg)) num_sentences, gen_timer.n, gen_timer.sum, num_sentences / gen_timer.sum, 1. / gen_timer.avg))
if has_target: if has_target:
print('| Generate {} with beam={}: {}'.format(args.gen_subset, args.beam, scorer.result_string())) print('| Generate {} with beam={}: {}'.format(args.gen_subset, args.beam, scorer.result_string()))
return scorer
def cli_main(): def cli_main():
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment