Merge branch 'pr/agrinh/457-2' into dev

This commit is contained in:
Eren Gölge 2021-04-28 21:50:44 +02:00
commit ed1de4e0db
9 changed files with 58 additions and 38 deletions

View File

@ -43,7 +43,7 @@ jobs:
run: python3 -m pip install --upgrade pip run: python3 -m pip install --upgrade pip
- name: Install TTS - name: Install TTS
run: | run: |
python3 -m pip install . python3 -m pip install .[all]
python3 setup.py egg_info python3 setup.py egg_info
- name: Lint check - name: Lint check
run: | run: |

View File

@ -1,5 +1,5 @@
.DEFAULT_GOAL := help .DEFAULT_GOAL := help
.PHONY: test deps style lint install help .PHONY: test system-deps dev-deps deps style lint install help
help: help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
@ -10,6 +10,10 @@ system-deps: ## install linux system deps
sudo apt-get install -y espeak-ng sudo apt-get install -y espeak-ng
sudo apt-get install -y libsndfile1-dev sudo apt-get install -y libsndfile1-dev
dev-deps: ## install development deps
pip install -r requirements.dev.txt
pip install -r requirements.tf.txt
deps: ## install 🐸 requirements. deps: ## install 🐸 requirements.
pip install -r requirements.txt pip install -r requirements.txt
@ -25,4 +29,4 @@ lint: ## run pylint linter.
pylint ${target_dirs} pylint ${target_dirs}
install: ## install 🐸 TTS for development. install: ## install 🐸 TTS for development.
pip install -e . pip install -e .[all]

View File

@ -111,11 +111,17 @@ If you are only interested in [synthesizing speech](https://github.com/coqui-ai/
pip install TTS pip install TTS
``` ```
By default this only installs the requirements for PyTorch. To install the tensorflow dependencies as well, use the `tf` extra.
```bash
pip install TTS[tf]
```
If you plan to code or train models, clone 🐸TTS and install it locally. If you plan to code or train models, clone 🐸TTS and install it locally.
```bash ```bash
git clone https://github.com/coqui-ai/TTS git clone https://github.com/coqui-ai/TTS
pip install -e . pip install -e .[all,dev,notebooks,tf] # Select the relevant extras
``` ```
We use ```espeak-ng``` to convert graphemes to phonemes. You might need to install separately. We use ```espeak-ng``` to convert graphemes to phonemes. You might need to install separately.

View File

@ -27,10 +27,8 @@ import zipfile
import pandas import pandas
import soundfile as sf import soundfile as sf
import tensorflow as tf
from absl import logging from absl import logging
gfile = tf.compat.v1.gfile
SUBSETS = { SUBSETS = {
"vox1_dev_wav": [ "vox1_dev_wav": [
@ -73,8 +71,7 @@ def download_and_extract(directory, subset, urls):
subset: subset name of the corpus. subset: subset name of the corpus.
urls: the list of urls to download the data file. urls: the list of urls to download the data file.
""" """
if not gfile.Exists(directory): os.makedirs(directory, exist_ok=True)
gfile.MakeDirs(directory)
try: try:
for url in urls: for url in urls:
@ -107,7 +104,7 @@ def download_and_extract(directory, subset, urls):
extract_path_ori = os.path.join(directory, zfile.infolist()[0].filename) extract_path_ori = os.path.join(directory, zfile.infolist()[0].filename)
subprocess.call("mv %s %s" % (extract_path_ori, extract_path), shell=True) subprocess.call("mv %s %s" % (extract_path_ori, extract_path), shell=True)
finally: finally:
# gfile.Remove(zip_filepath) # os.remove(zip_filepath)
pass pass
@ -160,7 +157,7 @@ def convert_audio_and_make_label(input_dir, subset, output_dir, output_file):
files = [] files = []
# Convert all AAC file into WAV format. At the same time, generate the csv # Convert all AAC file into WAV format. At the same time, generate the csv
for root, _, filenames in gfile.Walk(source_dir): for root, _, filenames in os.walk(source_dir):
for filename in filenames: for filename in filenames:
name, ext = os.path.splitext(filename) name, ext = os.path.splitext(filename)
if ext.lower() == ".wav": if ext.lower() == ".wav":
@ -172,7 +169,7 @@ def convert_audio_and_make_label(input_dir, subset, output_dir, output_file):
# Convert AAC to WAV. # Convert AAC to WAV.
aac_file = os.path.join(root, filename) aac_file = os.path.join(root, filename)
wav_file = aac_file + ".wav" wav_file = aac_file + ".wav"
if not gfile.Exists(wav_file): if not os.path.exists(wav_file):
if not decode_aac_with_ffmpeg(aac_file, wav_file): if not decode_aac_with_ffmpeg(aac_file, wav_file):
raise RuntimeError("Audio decoding failed.") raise RuntimeError("Audio decoding failed.")
else: else:

5
requirements.dev.txt Normal file
View File

@ -0,0 +1,5 @@
black
coverage
isort
nose
pylint==2.7.4

View File

@ -0,0 +1,2 @@
bokeh==1.4.0
numba==0.48

1
requirements.tf.txt Normal file
View File

@ -0,0 +1 @@
tensorflow==2.3.1

View File

@ -1,29 +1,20 @@
torch>=1.7
tensorflow==2.3.1
numpy==1.18.5
scipy>=0.19.0
numba==0.48
librosa==0.7.2
phonemizer>=2.2.0
unidecode==0.4.20
pypinyin
jieba
tensorboardX
matplotlib
Pillow
flask
tqdm
inflect
bokeh==1.4.0
pysbd
soundfile
gdown
umap-learn==0.4.6
cython cython
flask
gdown
inflect
jieba
librosa==0.7.2
matplotlib
numpy==1.18.5
pandas
phonemizer>=2.2.0
pypinyin
pysbd
pyyaml pyyaml
# quality and style scipy>=0.19.0
nose soundfile
coverage tensorboardX
black torch>=1.7
isort tqdm
pylint==2.7.4 umap-learn==0.4.6
unidecode==0.4.20

View File

@ -48,6 +48,14 @@ def pip_install(package_name):
requirements = open(os.path.join(cwd, 'requirements.txt'), 'r').readlines() requirements = open(os.path.join(cwd, 'requirements.txt'), 'r').readlines()
with open(os.path.join(cwd, 'requirements.notebooks.txt'), 'r') as f:
requirements_notebooks = f.readlines()
with open(os.path.join(cwd, 'requirements.dev.txt'), 'r') as f:
requirements_dev = f.readlines()
with open(os.path.join(cwd, 'requirements.tf.txt'), 'r') as f:
requirements_tf = f.readlines()
requirements_all = requirements_dev + requirements_notebooks + requirements_tf
with open('README.md', "r", encoding="utf-8") as readme_file: with open('README.md', "r", encoding="utf-8") as readme_file:
README = readme_file.read() README = readme_file.read()
@ -82,6 +90,12 @@ setup(
# 'build_ext': build_ext # 'build_ext': build_ext
}, },
install_requires=requirements, install_requires=requirements,
extras_require={
"all": requirements_all,
"dev": requirements_dev,
"notebooks": requirements_notebooks,
"tf": requirements_tf,
},
python_requires='>=3.6.0, <3.9', python_requires='>=3.6.0, <3.9',
entry_points={ entry_points={
'console_scripts': [ 'console_scripts': [