2020-12-03 08:41:04 +00:00
|
|
|
{ lib
|
|
|
|
, python3Packages
|
|
|
|
, fetchFromGitHub
|
|
|
|
, python3
|
2021-04-17 00:35:05 +00:00
|
|
|
, fetchpatch
|
2020-12-03 08:41:04 +00:00
|
|
|
}:
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
# USAGE:
|
|
|
|
# $ tts-server --list_models
|
|
|
|
# # pick your favorite vocoder/tts model
|
|
|
|
# $ tts-server --model_name tts_models/en/ljspeech/glow-tts --vocoder_name vocoder_models/universal/libri-tts/fullband-melgan
|
2020-12-03 08:41:04 +00:00
|
|
|
#
|
2021-04-17 00:35:05 +00:00
|
|
|
# If you upgrade from an old version you may have to delete old models from ~/.local/share/tts
|
|
|
|
# Also note that your tts version might not support all available models so check:
|
|
|
|
# https://github.com/coqui-ai/TTS/releases/tag/v0.0.12
|
|
|
|
#
|
2020-12-03 08:41:04 +00:00
|
|
|
# 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";
|
2021-04-17 00:35:05 +00:00
|
|
|
version = "0.0.12";
|
2020-12-03 08:41:04 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2021-04-17 00:35:05 +00:00
|
|
|
owner = "coqui-ai";
|
2020-12-03 08:41:04 +00:00
|
|
|
repo = "TTS";
|
2021-04-17 00:35:05 +00:00
|
|
|
rev = "v${version}";
|
|
|
|
sha256 = "sha256-0M9wcdBmuTK+NvEGsXEdoYiVFjw8G2MRUwmi1PJgmzI=";
|
2020-12-03 08:41:04 +00:00
|
|
|
};
|
|
|
|
|
2021-04-17 00:35:05 +00:00
|
|
|
patches = [
|
|
|
|
# https://github.com/coqui-ai/TTS/pull/435
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/coqui-ai/TTS/commit/97f98e4c4584ef14ed2f4885aa02c162d9364a00.patch";
|
|
|
|
sha256 = "sha256-DAZYOOAe+6TYBF5ukFq5HRwm49askEvNEivuwb/oCWM=";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2020-12-03 08:41:04 +00:00
|
|
|
preBuild = ''
|
|
|
|
# numba jit tries to write to its cache directory
|
|
|
|
export HOME=$TMPDIR
|
2021-02-05 17:12:51 +00:00
|
|
|
# we only support pytorch models right now
|
|
|
|
sed -i -e '/tensorflow/d' requirements.txt
|
|
|
|
|
2020-12-03 08:41:04 +00:00
|
|
|
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
|
2021-04-17 00:35:05 +00:00
|
|
|
sed -i -e 's!numpy==[^"]*!numpy!' requirements.txt setup.py
|
|
|
|
sed -i -e 's!umap-learn==[^"]*!umap-learn!' requirements.txt setup.py
|
2020-12-03 08:41:04 +00:00
|
|
|
# Not required for building/installation but for their development/ci workflow
|
2021-04-17 00:35:05 +00:00
|
|
|
sed -i -e '/black/d' requirements.txt
|
|
|
|
sed -i -e '/isor/d' requirements.txt
|
2021-02-05 17:12:51 +00:00
|
|
|
sed -i -e '/pylint/d' requirements.txt
|
2020-12-03 08:41:04 +00:00
|
|
|
sed -i -e '/cardboardlint/d' requirements.txt setup.py
|
|
|
|
'';
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
nativeBuildInputs = [ python3Packages.cython ];
|
2020-12-03 08:41:04 +00:00
|
|
|
|
|
|
|
propagatedBuildInputs = with python3Packages; [
|
|
|
|
attrdict
|
|
|
|
bokeh
|
2021-04-17 00:35:05 +00:00
|
|
|
flask
|
2020-12-03 08:41:04 +00:00
|
|
|
fuzzywuzzy
|
|
|
|
gdown
|
2021-04-17 00:35:05 +00:00
|
|
|
inflect
|
|
|
|
jieba
|
|
|
|
librosa
|
|
|
|
matplotlib
|
|
|
|
phonemizer
|
|
|
|
pypinyin
|
2020-12-03 08:41:04 +00:00
|
|
|
pysbd
|
2021-04-17 00:35:05 +00:00
|
|
|
pytorch
|
|
|
|
scipy
|
|
|
|
soundfile
|
|
|
|
tensorboardx
|
|
|
|
tqdm
|
|
|
|
umap-learn
|
|
|
|
unidecode
|
2020-12-03 08:41:04 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
cp -r TTS/server/templates/ $out/${python3.sitePackages}/TTS/server
|
2021-02-05 17:12:51 +00:00
|
|
|
# cython modules are not installed for some reasons
|
|
|
|
(
|
|
|
|
cd TTS/tts/layers/glow_tts/monotonic_align
|
|
|
|
${python3Packages.python.interpreter} setup.py install --prefix=$out
|
|
|
|
)
|
2020-12-03 08:41:04 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
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"
|
|
|
|
];
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
preCheck = ''
|
|
|
|
# use the installed TTS in $PYTHONPATH instead of the one from source to also have cython modules.
|
|
|
|
mv TTS{,.old}
|
|
|
|
'';
|
|
|
|
|
2021-04-17 00:35:05 +00:00
|
|
|
disabledTestPaths = [
|
2021-02-05 17:12:51 +00:00
|
|
|
# requires tensorflow
|
2021-04-17 00:35:05 +00:00
|
|
|
"tests/test_tacotron2_tf_model.py"
|
|
|
|
"tests/test_vocoder_tf_melgan_generator.py"
|
|
|
|
"tests/test_vocoder_tf_pqmf.py"
|
2021-02-05 17:12:51 +00:00
|
|
|
];
|
|
|
|
|
2020-12-03 08:41:04 +00:00
|
|
|
meta = with lib; {
|
2021-04-17 00:35:05 +00:00
|
|
|
homepage = "https://github.com/coqui-ai/TTS";
|
|
|
|
changelog = "https://github.com/coqui-ai/TTS/releases/tag/v${version}";
|
|
|
|
description = "Deep learning toolkit for Text-to-Speech, battle-tested in research and production";
|
2020-12-03 08:41:04 +00:00
|
|
|
license = licenses.mpl20;
|
|
|
|
maintainers = with maintainers; [ hexa mic92 ];
|
|
|
|
};
|
|
|
|
}
|