mirror of
https://github.com/facebookresearch/fairseq.git
synced 2024-09-11 17:25:31 +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)
|
print(ws)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
def cli_main():
|
||||||
parser = options.get_eval_lm_parser()
|
parser = options.get_eval_lm_parser()
|
||||||
args = options.parse_args_and_arch(parser)
|
args = options.parse_args_and_arch(parser)
|
||||||
main(args)
|
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()))
|
print('| Generate {} with beam={}: {}'.format(args.gen_subset, args.beam, scorer.result_string()))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
def cli_main():
|
||||||
parser = options.get_generation_parser()
|
parser = options.get_generation_parser()
|
||||||
args = options.parse_args_and_arch(parser)
|
args = options.parse_args_and_arch(parser)
|
||||||
main(args)
|
main(args)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
cli_main()
|
||||||
|
@ -183,7 +183,11 @@ def main(args):
|
|||||||
print(align)
|
print(align)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
def cli_main():
|
||||||
parser = options.get_generation_parser(interactive=True)
|
parser = options.get_generation_parser(interactive=True)
|
||||||
args = options.parse_args_and_arch(parser)
|
args = options.parse_args_and_arch(parser)
|
||||||
main(args)
|
main(args)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
cli_main()
|
||||||
|
@ -271,7 +271,11 @@ def merge_files(files, outpath):
|
|||||||
ds.finalize("{}.idx".format(outpath))
|
ds.finalize("{}.idx".format(outpath))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
def cli_main():
|
||||||
parser = options.get_preprocessing_parser()
|
parser = options.get_preprocessing_parser()
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
main(args)
|
main(args)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
cli_main()
|
||||||
|
10
setup.py
10
setup.py
@ -43,4 +43,14 @@ setup(
|
|||||||
packages=find_packages(),
|
packages=find_packages(),
|
||||||
ext_modules=[bleu],
|
ext_modules=[bleu],
|
||||||
test_suite='tests',
|
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)
|
main(args, init_distributed=True)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
def cli_main():
|
||||||
parser = options.get_training_parser()
|
parser = options.get_training_parser()
|
||||||
args = options.parse_args_and_arch(parser)
|
args = options.parse_args_and_arch(parser)
|
||||||
|
|
||||||
@ -415,3 +415,7 @@ if __name__ == '__main__':
|
|||||||
else:
|
else:
|
||||||
# single GPU training
|
# single GPU training
|
||||||
main(args)
|
main(args)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
cli_main()
|
||||||
|
Loading…
Reference in New Issue
Block a user