From 60c1bb93d9a424ab4881de9f2afc4edb848d4fc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eren=20G=C3=B6lge?= Date: Mon, 25 Jan 2021 11:16:20 +0100 Subject: [PATCH] fixes before first PyPI release --- README.md | 11 ++++++----- TTS/bin/synthesize.py | 6 +++++- TTS/server/README.md | 2 ++ setup.py | 39 ++++++++++++++++++++------------------- 4 files changed, 33 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 0738f2e9..76d0ab49 100644 --- a/README.md +++ b/README.md @@ -141,20 +141,21 @@ Some of the public datasets that we successfully applied TTS: ## Example: Synthesizing Speech on Terminal Using the Released Models. -TTS provides a CLI interface for synthesizing speech using pre-trained models. You can either use your own model or the release models under the TTS project. +After the installation, TTS provides a CLI interface for synthesizing speech using pre-trained models. You can either use your own model or the release models under the TTS project. Listing released TTS models. -```./TTS/bin/synthesize.py --list_models``` +```tts --list_models``` Run a tts and a vocoder model from the released model list. (Simply copy and paste the full model names from the list as arguments for the command below.) -```./TTS/bin/synthesize.py --text "Text for TTS" --model_name "///" --vocoder_name "///" --output_path``` +```tts --text "Text for TTS" --model_name "///" --vocoder_name "///" --output_path``` Run your own TTS model (Using Griffin-Lim Vocoder) -```./TTS/bin/synthesize.py --text "Text for TTS" --model_path path/to/model.pth.tar --config_path path/to/config.json --out_path output/path/speech.wav``` +```tts --text "Text for TTS" --model_path path/to/model.pth.tar --config_path path/to/config.json --out_path output/path/speech.wav``` Run your own TTS and Vocoder models -```./TTS/bin/synthesize.py --text "Text for TTS" --model_path path/to/config.json --config_path path/to/model.pth.tar --out_path output/path/speech.wav --vocoder_path path/to/vocoder.pth.tar --vocoder_config_path path/to/vocoder_config.json``` +```tts --text "Text for TTS" --model_path path/to/config.json --config_path path/to/model.pth.tar --out_path output/path/speech.wav --vocoder_path path/to/vocoder.pth.tar --vocoder_config_path path/to/vocoder_config.json``` +**Note:** You can use ```./TTS/bin/synthesize.py``` if you prefer running ```tts``` from the TTS project folder. ## Example: Training and Fine-tuning LJ-Speech Dataset Here you can find a [CoLab](https://gist.github.com/erogol/97516ad65b44dbddb8cd694953187c5b) notebook for a hands-on example, training LJSpeech. Or you can manually follow the guideline below. diff --git a/TTS/bin/synthesize.py b/TTS/bin/synthesize.py index 64d3298b..18bd6ac1 100755 --- a/TTS/bin/synthesize.py +++ b/TTS/bin/synthesize.py @@ -23,7 +23,7 @@ def str2bool(v): raise argparse.ArgumentTypeError('Boolean value expected.') -if __name__ == "__main__": +def main(): # pylint: disable=bad-continuation parser = argparse.ArgumentParser(description='''Synthesize speech on command line.\n\n''' @@ -216,3 +216,7 @@ if __name__ == "__main__": out_path = os.path.join(args.out_path, file_name) print(" > Saving output to {}".format(out_path)) synthesizer.save_wav(wav, out_path) + + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/TTS/server/README.md b/TTS/server/README.md index cd885839..a8d8635a 100644 --- a/TTS/server/README.md +++ b/TTS/server/README.md @@ -9,6 +9,8 @@ Instructions below are based on a Ubuntu 18.04 machine, but it should be simple ##### Using server.py If you have the environment set already for TTS, then you can directly call ```server.py```. +**Note:** After installing TTS as a package you can use ```tts-server``` to call the commands below. + Examples runs: List officially released models. diff --git a/setup.py b/setup.py index e07dea09..a7804ad6 100644 --- a/setup.py +++ b/setup.py @@ -33,22 +33,8 @@ args, unknown_args = parser.parse_known_args() # Remove our arguments from argv so that setuptools doesn't see them sys.argv = [sys.argv[0]] + unknown_args -version = '0.0.9' - -# Adapted from https://github.com/pytorch/pytorch +version = '0.0.9a0' cwd = os.path.dirname(os.path.abspath(__file__)) -if os.getenv('TTS_PYTORCH_BUILD_VERSION'): - version = os.getenv('TTS_PYTORCH_BUILD_VERSION') -else: - try: - sha = subprocess.check_output(['git', 'rev-parse', 'HEAD'], - cwd=cwd).decode('ascii').strip() - version += '+' + sha[:7] - except subprocess.CalledProcessError: - pass - except IOError: # FileNotFoundError for python 3 - pass - # Handle Cython code def find_pyx(path='.'): @@ -108,9 +94,11 @@ def pip_install(package_name): reqs_from_file = open('requirements.txt').readlines() # reqs_without_tf = [r for r in reqs_from_file if not r.startswith('tensorflow')] # tf_req = [r for r in reqs_from_file if r.startswith('tensorflow')] - # requirements = {'install_requires': reqs_without_tf, 'pip_install': tf_req} +with open('README.md', "r", encoding="utf-8") as readme_file: + README = readme_file.read() + setup( name='TTS', version=version, @@ -118,8 +106,8 @@ setup( author='Eren Gölge', author_email='egolge@mozilla.com', description='Text to Speech with Deep Learning', + # long_description=README, license='MPL-2.0', - entry_points={'console_scripts': ['tts-server = TTS.server.server:main']}, ext_modules=find_cython_extensions(), packages=find_packages(include=['TTS*']), project_urls={ @@ -134,17 +122,30 @@ setup( }, install_requires=reqs_from_file, python_requires='>=3.6.0', + entry_points={ + 'console_scripts': [ + 'tts=TTS.bin.synthesize:main', + 'tts-server = TTS.server.server:main' + ] + }, classifiers=[ "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", 'Development Status :: 3 - Alpha', - "Intended Audience :: Science/Research :: Developers", + "Intended Audience :: Science/Research", + "Intended Audience :: Developers", "Operating System :: POSIX :: Linux", 'License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)', - "Topic :: Software Development :: Libraries :: Python Modules :: Speech :: Sound/Audio :: Multimedia :: Artificial Intelligence", + "Topic :: Software Development", + "Topic :: Software Development :: Libraries :: Python Modules", + "Topic :: Multimedia :: Sound/Audio :: Speech", + "Topic :: Multimedia :: Sound/Audio", + "Topic :: Multimedia", + "Topic :: Scientific/Engineering :: Artificial Intelligence" ]) # for some reason having tensorflow in 'install_requires'