From 54d55ea0b1b2640a1544ee2a0c46895a22e9d805 Mon Sep 17 00:00:00 2001 From: Eren Date: Wed, 20 Jun 2018 17:10:27 +0200 Subject: [PATCH 1/6] basic config added --- config.json | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 config.json diff --git a/config.json b/config.json new file mode 100644 index 00000000..572ce28c --- /dev/null +++ b/config.json @@ -0,0 +1,32 @@ +{ + "model_name": "best-model", + "num_mels": 80, + "num_freq": 1025, + "sample_rate": 20000, + "frame_length_ms": 50, + "frame_shift_ms": 12.5, + "preemphasis": 0.97, + "min_level_db": -100, + "ref_level_db": 20, + "embedding_size": 256, + "text_cleaner": "english_cleaners", + + "epochs": 1000, + "lr": 0.002, + "warmup_steps": 4000, + "batch_size": 32, + "eval_batch_size":32, + "r": 5, + + "griffin_lim_iters": 60, + "power": 1.5, + + "num_loader_workers": 8, + + "checkpoint": true, + "save_step": 376, + "data_path": "/snakepit/shared/data/keithito/LJSpeech-1.1/", + "min_seq_len": 0, + "output_path": "models/" + } + \ No newline at end of file From 1f3067c15f5417d2a64aa9df955792db1eeddd95 Mon Sep 17 00:00:00 2001 From: Eren Date: Thu, 21 Jun 2018 14:10:21 +0200 Subject: [PATCH 2/6] pit scripts --- .compute | 3 +++ .install | 4 ++++ requirements.txt | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 .compute create mode 100644 .install diff --git a/.compute b/.compute new file mode 100644 index 00000000..673cbe27 --- /dev/null +++ b/.compute @@ -0,0 +1,3 @@ +#!/bin/bash +source ../tmp/venv/bin/activate +python train.py --config_path config.json diff --git a/.install b/.install new file mode 100644 index 00000000..48731936 --- /dev/null +++ b/.install @@ -0,0 +1,4 @@ +#!/bin/bash +virtualenv -p python3 ../tmp/venv +source ../tmp/venv/bin/activate +pip install --no-cache-dir -r requirements.txt diff --git a/requirements.txt b/requirements.txt index f2997902..74a57e47 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,9 +1,9 @@ +torch librosa inflect unidecode tensorboard tensorboardX -torch matplotlib Pillow flask From 461f144b17d44ac6c914c27ea9ce397e9881001d Mon Sep 17 00:00:00 2001 From: Eren Date: Thu, 21 Jun 2018 15:46:20 +0200 Subject: [PATCH 3/6] unix line endings --- .compute | 7 ++++--- .install | 8 ++++---- requirements.txt | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.compute b/.compute index 673cbe27..6cbb79f2 100644 --- a/.compute +++ b/.compute @@ -1,3 +1,4 @@ -#!/bin/bash -source ../tmp/venv/bin/activate -python train.py --config_path config.json +#!/bin/bash +source ../tmp/venv/bin/activate +export PYTHONPATH=' +python train.py --config_path config.json \ No newline at end of file diff --git a/.install b/.install index 48731936..e977c98b 100644 --- a/.install +++ b/.install @@ -1,4 +1,4 @@ -#!/bin/bash -virtualenv -p python3 ../tmp/venv -source ../tmp/venv/bin/activate -pip install --no-cache-dir -r requirements.txt +#!/bin/bash +virtualenv -p python3 ../tmp/venv +source ../tmp/venv/bin/activate +pip install --no-cache-dir -r requirements.txt diff --git a/requirements.txt b/requirements.txt index 74a57e47..4628a6ae 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -torch +torch>=0.4.0 librosa inflect unidecode From a0b7a181c36af5406d2dc6e35266b6b4b4d5c4c2 Mon Sep 17 00:00:00 2001 From: Eren Date: Thu, 21 Jun 2018 15:48:13 +0200 Subject: [PATCH 4/6] add setup.py --- .gitignore | 3 ++ setup.py | 87 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 90 insertions(+) create mode 100644 setup.py diff --git a/.gitignore b/.gitignore index 1418de63..24b13870 100644 --- a/.gitignore +++ b/.gitignore @@ -116,5 +116,8 @@ venv.bak/ *.pth.tar result/ +# setup.py +version.py + # jupyter dummy files core diff --git a/setup.py b/setup.py new file mode 100644 index 00000000..c3c4c001 --- /dev/null +++ b/setup.py @@ -0,0 +1,87 @@ +#!/usr/bin/env python + +from setuptools import setup, find_packages +import setuptools.command.develop +import setuptools.command.build_py +import os +import subprocess +from os.path import exists + +version = '0.0.1' + +# Adapted from https://github.com/pytorch/pytorch +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 + + +class build_py(setuptools.command.build_py.build_py): + + def run(self): + self.create_version_file() + setuptools.command.build_py.build_py.run(self) + + @staticmethod + def create_version_file(): + global version, cwd + print('-- Building version ' + version) + version_path = os.path.join(cwd, 'version.py') + with open(version_path, 'w') as f: + f.write("__version__ = '{}'\n".format(version)) + + +class develop(setuptools.command.develop.develop): + + def run(self): + build_py.create_version_file() + setuptools.command.develop.develop.run(self) + + +def create_readme_rst(): + global cwd + try: + subprocess.check_call( + ["pandoc", "--from=markdown", "--to=rst", "--output=README.rst", + "README.md"], cwd=cwd) + print("Generated README.rst from README.md using pandoc.") + except subprocess.CalledProcessError: + pass + except OSError: + pass + + +setup(name='TTS', + version=version, + url='https://github.com/mozilla/TTS', + description='Text to Speech with Deep Learning', + packages=find_packages(), + cmdclass={ + 'build_py': build_py, + 'develop': develop, + }, + install_requires=[ + "numpy", + "scipy", + "torch >= 0.4.0", + "unidecode", + "tensorboardX", + "matplotlib", + "Pillow", + "flask", + ], + extras_require={ + "bin": [ + "tqdm", + "tensorboardX", + "requests", + ], + }) \ No newline at end of file From 01739d4e8d92e592cf5c79bbf2303dcca3c0783f Mon Sep 17 00:00:00 2001 From: Eren Date: Thu, 21 Jun 2018 16:33:30 +0200 Subject: [PATCH 5/6] fix import statements --- .compute | 1 - .install | 2 +- __init__.py | 0 datasets/LJSpeech.py | 6 +++--- models/tacotron.py | 4 ++-- setup.py | 1 + utils/text/__init__.py | 4 ++-- utils/text/symbols.py | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) delete mode 100644 __init__.py diff --git a/.compute b/.compute index 6cbb79f2..ff6a8360 100644 --- a/.compute +++ b/.compute @@ -1,4 +1,3 @@ #!/bin/bash source ../tmp/venv/bin/activate -export PYTHONPATH=' python train.py --config_path config.json \ No newline at end of file diff --git a/.install b/.install index e977c98b..acc7b6cc 100644 --- a/.install +++ b/.install @@ -1,4 +1,4 @@ #!/bin/bash virtualenv -p python3 ../tmp/venv source ../tmp/venv/bin/activate -pip install --no-cache-dir -r requirements.txt +python setup.py develop diff --git a/__init__.py b/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/datasets/LJSpeech.py b/datasets/LJSpeech.py index 03ccee28..7638e708 100644 --- a/datasets/LJSpeech.py +++ b/datasets/LJSpeech.py @@ -5,9 +5,9 @@ import librosa import torch from torch.utils.data import Dataset -from TTS.utils.text import text_to_sequence -from TTS.utils.audio import AudioProcessor -from TTS.utils.data import (prepare_data, pad_per_step, +from utils.text import text_to_sequence +from utils.audio import AudioProcessor +from utils.data import (prepare_data, pad_per_step, prepare_tensor, prepare_stop_target) diff --git a/models/tacotron.py b/models/tacotron.py index 71253149..1b0923a4 100644 --- a/models/tacotron.py +++ b/models/tacotron.py @@ -1,8 +1,8 @@ # coding: utf-8 import torch from torch import nn -from TTS.utils.text.symbols import symbols -from TTS.layers.tacotron import Prenet, Encoder, Decoder, CBHG +from utils.text.symbols import symbols +from layers.tacotron import Prenet, Encoder, Decoder, CBHG class Tacotron(nn.Module): diff --git a/setup.py b/setup.py index c3c4c001..06afe37a 100644 --- a/setup.py +++ b/setup.py @@ -71,6 +71,7 @@ setup(name='TTS', install_requires=[ "numpy", "scipy", + "librosa", "torch >= 0.4.0", "unidecode", "tensorboardX", diff --git a/utils/text/__init__.py b/utils/text/__init__.py index 9b812c27..3d158c99 100644 --- a/utils/text/__init__.py +++ b/utils/text/__init__.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- import re -from TTS.utils.text import cleaners -from TTS.utils.text.symbols import symbols +from utils.text import cleaners +from utils.text.symbols import symbols # Mappings from symbol to numeric ID and vice versa: diff --git a/utils/text/symbols.py b/utils/text/symbols.py index a1706b23..c8550e1d 100644 --- a/utils/text/symbols.py +++ b/utils/text/symbols.py @@ -7,7 +7,7 @@ Defines the set of symbols used in text input to the model. The default is a set of ASCII characters that works well for English or text that has been run through Unidecode. For other data, you can modify _characters. See TRAINING_DATA.md for details. ''' -from TTS.utils.text import cmudict +from utils.text import cmudict _pad = '_' _eos = '~' From 3e6cdeee1d6697a774c7055b848548223121f382 Mon Sep 17 00:00:00 2001 From: Eren Date: Thu, 21 Jun 2018 18:56:23 +0200 Subject: [PATCH 6/6] install script commit --- .install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.install b/.install index acc7b6cc..0ae9b43b 100644 --- a/.install +++ b/.install @@ -1,4 +1,4 @@ #!/bin/bash virtualenv -p python3 ../tmp/venv source ../tmp/venv/bin/activate -python setup.py develop +python setup.py develop \ No newline at end of file