Commit fbd4cef9 authored by Myle Ott's avatar Myle Ott Committed by Facebook Github Bot
Browse files

Add fairseq to PyPI (#495)

Summary:
- fairseq can now be installed via pip: `pip install fairseq`
- command-line tools are globally accessible: `fairseq-preprocess`, `fairseq-train`, `fairseq-generate`, etc.
Pull Request resolved: https://github.com/pytorch/fairseq/pull/495

Differential Revision: D14017761

Pulled By: myleott

fbshipit-source-id: 10c9f6634a3056074eac2f33324b4f1f404d4235
parent cea0e4b9
../generate.py
\ No newline at end of file
../interactive.py
\ No newline at end of file
../preprocess.py
\ No newline at end of file
../score.py
\ No newline at end of file
../setup.py
\ No newline at end of file
../train.py
\ No newline at end of file
...@@ -17,4 +17,4 @@ fi ...@@ -17,4 +17,4 @@ fi
grep ^H $GEN | cut -f3- | perl -ple 's{(\S)-(\S)}{$1 ##AT##-##AT## $2}g' > $SYS grep ^H $GEN | cut -f3- | perl -ple 's{(\S)-(\S)}{$1 ##AT##-##AT## $2}g' > $SYS
grep ^T $GEN | cut -f2- | perl -ple 's{(\S)-(\S)}{$1 ##AT##-##AT## $2}g' > $REF grep ^T $GEN | cut -f2- | perl -ple 's{(\S)-(\S)}{$1 ##AT##-##AT## $2}g' > $REF
python score.py --sys $SYS --ref $REF fairseq-score --sys $SYS --ref $REF
...@@ -16,12 +16,6 @@ if sys.version_info < (3,): ...@@ -16,12 +16,6 @@ if sys.version_info < (3,):
with open('README.md') as f: with open('README.md') as f:
readme = f.read() readme = f.read()
with open('LICENSE') as f:
license = f.read()
with open('requirements.txt') as f:
reqs = f.read()
bleu = Extension( bleu = Extension(
'fairseq.libbleu', 'fairseq.libbleu',
...@@ -35,22 +29,33 @@ bleu = Extension( ...@@ -35,22 +29,33 @@ bleu = Extension(
setup( setup(
name='fairseq', name='fairseq',
version='0.6.0', version='0.6.1',
description='Facebook AI Research Sequence-to-Sequence Toolkit', description='Facebook AI Research Sequence-to-Sequence Toolkit',
url='https://github.com/pytorch/fairseq',
classifiers=[
'Intended Audience :: Science/Research',
'License :: OSI Approved :: BSD License',
'Programming Language :: Python :: 3.6',
'Topic :: Scientific/Engineering :: Artificial Intelligence',
],
long_description=readme, long_description=readme,
license=license, install_requires=[
install_requires=reqs.strip().split('\n'), 'cffi',
packages=find_packages(), 'numpy',
'torch',
'tqdm',
],
packages=find_packages(exclude=['scripts', 'tests']),
ext_modules=[bleu], ext_modules=[bleu],
test_suite='tests', test_suite='tests',
entry_points={ entry_points={
'console_scripts': [ 'console_scripts': [
'fairseq-eval-lm = eval_lm:cli_main', 'fairseq-eval-lm = fairseq_cli.eval_lm:cli_main',
'fairseq-generate = generate:cli_main', 'fairseq-generate = fairseq_cli.generate:cli_main',
'fairseq-interactive = interactive:cli_main', 'fairseq-interactive = fairseq_cli.interactive:cli_main',
'fairseq-preprocess = preprocess:cli_main', 'fairseq-preprocess = fairseq_cli.preprocess:cli_main',
'fairseq-train = train:cli_main', 'fairseq-train = fairseq_cli.train:cli_main',
'fairseq-score = score:main', 'fairseq-score = fairseq_cli.score:main',
], ],
}, },
) )
...@@ -395,18 +395,8 @@ def cli_main(): ...@@ -395,18 +395,8 @@ def cli_main():
port = random.randint(10000, 20000) port = random.randint(10000, 20000)
args.distributed_init_method = 'tcp://localhost:{port}'.format(port=port) args.distributed_init_method = 'tcp://localhost:{port}'.format(port=port)
args.distributed_rank = None # set based on device id args.distributed_rank = None # set based on device id
print( if max(args.update_freq) > 1 and args.ddp_backend != 'no_c10d':
'''| NOTE: you may get better performance with: print('| NOTE: you may get better performance with: --ddp-backend=no_c10d')
python -m torch.distributed.launch --nproc_per_node {ngpu} train.py {no_c10d}(...)
'''.format(
ngpu=args.distributed_world_size,
no_c10d=(
'--ddp-backend=no_c10d ' if max(args.update_freq) > 1 and args.ddp_backend != 'no_c10d'
else ''
),
)
)
torch.multiprocessing.spawn( torch.multiprocessing.spawn(
fn=distributed_main, fn=distributed_main,
args=(args, ), args=(args, ),
......
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