Skip to content

Commit 167f864

Browse files
author
Agrin Hilmkil
committed
Move dev, tf, notebook dependencies to extras
1 parent 6353e87 commit 167f864

9 files changed

+44
-21
lines changed

.github/workflows/main.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
run: python3 -m pip install --upgrade pip
4444
- name: Install TTS
4545
run: |
46-
python3 -m pip install .
46+
python3 -m pip install .[all]
4747
python3 setup.py egg_info
4848
- name: Lint check
4949
run: |

Makefile

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.DEFAULT_GOAL := help
2-
.PHONY: test deps style lint install help
2+
.PHONY: test system-deps dev-deps deps style lint install help
33

44
help:
55
@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
1010
sudo apt-get install -y espeak-ng
1111
sudo apt-get install -y libsndfile1-dev
1212

13+
dev-deps: ## install development deps
14+
pip install -r requirements.dev.txt
15+
pip install -r requirements.tf.txt
16+
1317
deps: ## install 🐸 requirements.
1418
pip install -r requirements.txt
1519

@@ -25,4 +29,4 @@ lint: ## run pylint linter.
2529
pylint ${target_dirs}
2630

2731
install: ## install 🐸 TTS for development.
28-
pip install -e .
32+
pip install -e .[all]

README.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,17 @@ If you are only interested in [synthesizing speech](https://github.com/coqui-ai/
110110
pip install TTS
111111
```
112112

113+
By default this only installs the requirements for PyTorch. To install the tensorflow dependencies as well, use the `tf` extra.
114+
115+
```bash
116+
pip install TTS[tf]
117+
```
118+
113119
If you plan to code or train models, clone 🐸TTS and install it locally.
114120

115121
```bash
116122
git clone https://github.com/coqui-ai/TTS
117-
pip install -e .
123+
pip install -e .[all,dev,notebooks,tf] # Select the relevant extras
118124
```
119125

120126
We use ```espeak-ng``` to convert graphemes to phonemes. You might need to install separately.
@@ -127,6 +133,7 @@ If you are on Ubuntu (Debian), you can also run following commands for installat
127133

128134
```bash
129135
$ make system-deps # intended to be used on Ubuntu (Debian). Let us know if you have a diffent OS.
136+
$ make dev-deps # Dependencies only required for development
130137
$ make install
131138
```
132139

TTS/speaker_encoder/utils/prepare_voxceleb.py

+6-7
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,11 @@
2525
import sys
2626
import zipfile
2727

28+
import fsspec
2829
import pandas
2930
import soundfile as sf
30-
import tensorflow as tf
3131
from absl import logging
3232

33-
gfile = tf.compat.v1.gfile
3433

3534
SUBSETS = {
3635
"vox1_dev_wav": [
@@ -73,8 +72,7 @@ def download_and_extract(directory, subset, urls):
7372
subset: subset name of the corpus.
7473
urls: the list of urls to download the data file.
7574
"""
76-
if not gfile.Exists(directory):
77-
gfile.MakeDirs(directory)
75+
fsspec.get_mapper(directory).fs.makedirs(directory, exist_ok=True)
7876

7977
try:
8078
for url in urls:
@@ -107,7 +105,7 @@ def download_and_extract(directory, subset, urls):
107105
extract_path_ori = os.path.join(directory, zfile.infolist()[0].filename)
108106
subprocess.call("mv %s %s" % (extract_path_ori, extract_path), shell=True)
109107
finally:
110-
# gfile.Remove(zip_filepath)
108+
# fsspec.get_mapper(directory).fs.rm_file(zip_filepath)
111109
pass
112110

113111

@@ -160,7 +158,8 @@ def convert_audio_and_make_label(input_dir, subset, output_dir, output_file):
160158

161159
files = []
162160
# Convert all AAC file into WAV format. At the same time, generate the csv
163-
for root, _, filenames in gfile.Walk(source_dir):
161+
fs = fsspec.get_mapper(source_dir).fs
162+
for root, _, filenames in fs.walk(source_dir):
164163
for filename in filenames:
165164
name, ext = os.path.splitext(filename)
166165
if ext.lower() == ".wav":
@@ -172,7 +171,7 @@ def convert_audio_and_make_label(input_dir, subset, output_dir, output_file):
172171
# Convert AAC to WAV.
173172
aac_file = os.path.join(root, filename)
174173
wav_file = aac_file + ".wav"
175-
if not gfile.Exists(wav_file):
174+
if not fs.exists(wav_file):
176175
if not decode_aac_with_ffmpeg(aac_file, wav_file):
177176
raise RuntimeError("Audio decoding failed.")
178177
else:

requirements.dev.txt

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
nose
2+
coverage
3+
black
4+
isort
5+
pylint==2.7.4

requirements.notebooks.txt

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
bokeh==1.4.0
2+
numba==0.48

requirements.tf.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
tensorflow==2.3.1

requirements.txt

+1-10
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,20 @@
11
torch>=1.7
2-
tensorflow==2.3.1
32
numpy==1.18.5
43
scipy>=0.19.0
5-
numba==0.48
64
librosa==0.7.2
75
phonemizer>=2.2.0
86
unidecode==0.4.20
97
pypinyin
108
jieba
119
tensorboardX
1210
matplotlib
13-
Pillow
1411
flask
1512
tqdm
1613
inflect
17-
bokeh==1.4.0
1814
pysbd
1915
soundfile
2016
gdown
2117
umap-learn==0.4.6
2218
cython
2319
pyyaml
24-
# quality and style
25-
nose
26-
coverage
27-
black
28-
isort
29-
pylint==2.7.4
20+
fsspec>=0.8.0

setup.py

+14
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@ def pip_install(package_name):
4848

4949

5050
requirements = open(os.path.join(cwd, 'requirements.txt'), 'r').readlines()
51+
with open(os.path.join(cwd, 'requirements.notebooks.txt'), 'r') as f:
52+
requirements_notebooks = f.readlines()
53+
with open(os.path.join(cwd, 'requirements.dev.txt'), 'r') as f:
54+
requirements_dev = f.readlines()
55+
with open(os.path.join(cwd, 'requirements.tf.txt'), 'r') as f:
56+
requirements_tf = f.readlines()
57+
requirements_all = requirements_dev + requirements_notebooks + requirements_tf
58+
5159
with open('README.md', "r", encoding="utf-8") as readme_file:
5260
README = readme_file.read()
5361

@@ -82,6 +90,12 @@ def pip_install(package_name):
8290
# 'build_ext': build_ext
8391
},
8492
install_requires=requirements,
93+
extras_require={
94+
"all": requirements_all,
95+
"dev": requirements_dev,
96+
"notebooks": requirements_notebooks,
97+
"tf": requirements_tf,
98+
},
8599
python_requires='>=3.6.0, <3.9',
86100
entry_points={
87101
'console_scripts': [

0 commit comments

Comments
 (0)