mirror of
https://github.com/facebookresearch/fairseq.git
synced 2024-08-17 12:31:05 +03:00
Add standalone binaries
Summary: Pull Request resolved: https://github.com/pytorch/fairseq/pull/489 Differential Revision: D13956810 Pulled By: myleott fbshipit-source-id: 61ace179d1d3790226c38b3f3e47f5452b5ec514
This commit is contained in:
parent
bbb4120b00
commit
829bd8ce5f
@ -174,7 +174,11 @@ def main(parsed_args):
|
||||
print(ws)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def cli_main():
|
||||
parser = options.get_eval_lm_parser()
|
||||
args = options.parse_args_and_arch(parser)
|
||||
main(args)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
cli_main()
|
||||
|
@ -178,7 +178,11 @@ def main(args):
|
||||
print('| Generate {} with beam={}: {}'.format(args.gen_subset, args.beam, scorer.result_string()))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def cli_main():
|
||||
parser = options.get_generation_parser()
|
||||
args = options.parse_args_and_arch(parser)
|
||||
main(args)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
cli_main()
|
||||
|
@ -183,7 +183,11 @@ def main(args):
|
||||
print(align)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def cli_main():
|
||||
parser = options.get_generation_parser(interactive=True)
|
||||
args = options.parse_args_and_arch(parser)
|
||||
main(args)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
cli_main()
|
||||
|
@ -271,7 +271,11 @@ def merge_files(files, outpath):
|
||||
ds.finalize("{}.idx".format(outpath))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
def cli_main():
|
||||
parser = options.get_preprocessing_parser()
|
||||
args = parser.parse_args()
|
||||
main(args)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
cli_main()
|
||||
|
10
setup.py
10
setup.py
@ -43,4 +43,14 @@ setup(
|
||||
packages=find_packages(),
|
||||
ext_modules=[bleu],
|
||||
test_suite='tests',
|
||||
entry_points={
|
||||
'console_scripts': [
|
||||
'fairseq-eval-lm = eval_lm:cli_main',
|
||||
'fairseq-generate = generate:cli_main',
|
||||
'fairseq-interactive = interactive:cli_main',
|
||||
'fairseq-preprocess = preprocess:cli_main',
|
||||
'fairseq-train = train:cli_main',
|
||||
'fairseq-score = score:main',
|
||||
],
|
||||
},
|
||||
)
|
||||
|
6
train.py
6
train.py
@ -380,7 +380,7 @@ def distributed_main(i, args):
|
||||
main(args, init_distributed=True)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def cli_main():
|
||||
parser = options.get_training_parser()
|
||||
args = options.parse_args_and_arch(parser)
|
||||
|
||||
@ -415,3 +415,7 @@ if __name__ == '__main__':
|
||||
else:
|
||||
# single GPU training
|
||||
main(args)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
cli_main()
|
||||
|
Loading…
Reference in New Issue
Block a user