blob: 1634bfa5b30713c86bd20e8846842fc4f32c797c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
|
{ lib
, python3Packages
, fetchFromGitHub
, fetchpatch
, python3
}:
#
# Tested in the following setup:
#
# TTS model:
# Tacotron2 DDC
# https://drive.google.com/drive/folders/1Y_0PcB7W6apQChXtbt6v3fAiNwVf4ER5
# Vocoder model:
# Multi-Band MelGAN
# https://drive.google.com/drive/folders/1XeRT0q4zm5gjERJqwmX5w84pMrD00cKD
#
# Arrange /tmp/tts like this:
# scale_stats.npy
# tts
# tts/checkpoint_130000.pth.tar
# tts/checkpoint_130000_tf.pkl
# tts/checkpoint_130000_tf_2.3rc0.tflite
# tts/config.json
# tts/scale_stats.npy
# vocoder
# vocoder/checkpoint_1450000.pth.tar
# vocoder/checkpoint_2750000_tf.pkl
# vocoder/checkpoint_2750000_tf_v2.3rc.tflite
# vocoder/config.json
# vocoder/scale_stats.npy
#
# Start like this:
# cd /tmp/tts
# tts-server \
# --vocoder_config ./tts/vocoder/config.json \
# --vocoder_checkpoint ./tts/vocoder/checkpoint_1450000.pth.tar \
# --tts_config ./tts/config.json \
# --tts_checkpoint ./tts/checkpoint_130000.pth.tar
#
# For now, for deployment check the systemd unit in the pull request:
# https://github.com/NixOS/nixpkgs/pull/103851#issue-521121136
#
python3Packages.buildPythonApplication rec {
pname = "tts";
# until https://github.com/mozilla/TTS/issues/424 is resolved
# we treat released models as released versions:
# https://github.com/mozilla/TTS/wiki/Released-Models
version = "unstable-2020-06-17";
src = fetchFromGitHub {
owner = "mozilla";
repo = "TTS";
rev = "72a6ac54c8cfaa407fc64b660248c6a788bdd381";
sha256 = "1wvs264if9n5xzwi7ryxvwj1j513szp6sfj6n587xk1fphi0921f";
};
patches = [
(fetchpatch {
url = "https://github.com/mozilla/TTS/commit/36fee428b9f3f4ec1914b090a2ec9d785314d9aa.patch";
sha256 = "sha256-pP0NxiyrsvQ0A7GEleTdT87XO08o7WxPEpb6Bmj66dc=";
})
(fetchpatch {
url = "https://github.com/Mic92/TTS/commit/5bf62009e8c19e8c1627d1f7aa54e11bc5fa91d7.patch";
sha256 = "sha256-ZxDytieD0zoP0/RXzG0bbVnl0oE+DF8iUVpHb8+2TqM=";
})
(fetchpatch {
url = "https://github.com/mozilla/TTS/commit/3000647e542fce9773f4c5da082630befa5525f1.patch";
sha256 = "sha256-dl8Zy0dEw9z4ZZFcuP1WHzCVh2+nn0jDKOncoCK+syM=";
})
(fetchpatch {
url = "https://github.com/mozilla/TTS/commit/fe86a076bb1c7e18078718be0aa36da427f325bd.patch";
sha256 = "sha256-cT5HYkLFzmSMwAHLOHgpG+v9HGKIbUxwS8Dt9SKHm+8=";
})
];
preBuild = ''
# numba jit tries to write to its cache directory
export HOME=$TMPDIR
sed -i -e 's!tensorflow==.*!tensorflow!' requirements.txt
sed -i -e 's!librosa==[^"]*!librosa!' requirements.txt setup.py
sed -i -e 's!unidecode==[^"]*!unidecode!' requirements.txt setup.py
sed -i -e 's!bokeh==[^"]*!bokeh!' requirements.txt setup.py
sed -i -e 's!numba==[^"]*!numba!' requirements.txt setup.py
# Not required for building/installation but for their development/ci workflow
sed -i -e '/pylint/d' requirements.txt setup.py
sed -i -e '/cardboardlint/d' requirements.txt setup.py
'';
propagatedBuildInputs = with python3Packages; [
matplotlib
scipy
pytorch
flask
attrdict
bokeh
soundfile
tqdm
librosa
unidecode
phonemizer
tensorboardx
fuzzywuzzy
tensorflow_2
inflect
gdown
pysbd
pyworld
];
postInstall = ''
cp -r TTS/server/templates/ $out/${python3.sitePackages}/TTS/server
'';
checkInputs = with python3Packages; [ pytestCheckHook ];
disabledTests = [
# RuntimeError: fft: ATen not compiled with MKL support
"test_torch_stft"
"test_stft_loss"
"test_multiscale_stft_loss"
# AssertionErrors that I feel incapable of debugging
"test_phoneme_to_sequence"
"test_text2phone"
"test_parametrized_gan_dataset"
];
meta = with lib; {
homepage = "https://github.com/mozilla/TTS";
description = "Deep learning for Text to Speech";
license = licenses.mpl20;
maintainers = with maintainers; [ hexa mic92 ];
};
}
|