2020-12-03 08:41:04 +00:00
|
|
|
{ lib
|
2021-08-05 21:33:18 +00:00
|
|
|
, python3
|
2020-12-03 08:41:04 +00:00
|
|
|
, fetchFromGitHub
|
|
|
|
}:
|
|
|
|
|
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
|
|
|
|
#
|
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
|
|
|
|
|
2021-08-05 21:33:18 +00:00
|
|
|
python3.pkgs.buildPythonApplication rec {
|
2020-12-03 08:41:04 +00:00
|
|
|
pname = "tts";
|
2022-01-03 16:56:52 +00:00
|
|
|
version = "0.4.2";
|
2021-07-21 07:28:18 +00:00
|
|
|
|
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}";
|
2022-01-03 16:56:52 +00:00
|
|
|
sha256 = "sha256-8a68iFbqqKwtZvufu1Vnv6hGHIQ3HU34wjuQsmr1NUA=";
|
2020-12-03 08:41:04 +00:00
|
|
|
};
|
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
postPatch = ''
|
2021-09-18 10:52:07 +00:00
|
|
|
sed -i requirements.txt \
|
|
|
|
-e 's!librosa==[^"]*!librosa!' \
|
2022-01-03 16:56:52 +00:00
|
|
|
-e 's!gruut\[.*\]~=2.0.0!gruut!' \
|
2021-09-18 10:52:07 +00:00
|
|
|
-e 's!mecab-python3==[^"]*!mecab-python3!' \
|
|
|
|
-e 's!numba==[^"]*!numba!' \
|
|
|
|
-e 's!numpy==[^"]*!numpy!' \
|
|
|
|
-e 's!umap-learn==[^"]*!umap-learn!'
|
2020-12-03 08:41:04 +00:00
|
|
|
'';
|
|
|
|
|
2021-07-21 07:28:18 +00:00
|
|
|
nativeBuildInputs = with python3.pkgs; [
|
2021-05-20 23:08:51 +00:00
|
|
|
cython
|
|
|
|
];
|
2020-12-03 08:41:04 +00:00
|
|
|
|
2021-07-21 07:28:18 +00:00
|
|
|
propagatedBuildInputs = with python3.pkgs; [
|
2021-06-28 23:13:55 +00:00
|
|
|
anyascii
|
2021-05-20 23:08:51 +00:00
|
|
|
coqpit
|
2021-04-17 00:35:05 +00:00
|
|
|
flask
|
2021-08-12 14:41:47 +00:00
|
|
|
fsspec
|
2021-07-14 22:03:04 +00:00
|
|
|
gruut
|
2020-12-03 08:41:04 +00:00
|
|
|
gdown
|
2021-04-17 00:35:05 +00:00
|
|
|
inflect
|
|
|
|
jieba
|
|
|
|
librosa
|
|
|
|
matplotlib
|
2021-06-28 23:13:55 +00:00
|
|
|
mecab-python3
|
2021-05-20 23:08:51 +00:00
|
|
|
numba
|
|
|
|
pandas
|
2021-04-17 00:35:05 +00:00
|
|
|
pypinyin
|
2020-12-03 08:41:04 +00:00
|
|
|
pysbd
|
2021-04-17 00:35:05 +00:00
|
|
|
pytorch
|
2021-09-18 10:52:07 +00:00
|
|
|
pyworld
|
2021-04-17 00:35:05 +00:00
|
|
|
scipy
|
|
|
|
soundfile
|
|
|
|
tensorboardx
|
2021-06-28 23:13:55 +00:00
|
|
|
tensorflow
|
2021-04-17 00:35:05 +00:00
|
|
|
tqdm
|
|
|
|
umap-learn
|
2021-06-28 23:13:55 +00:00
|
|
|
unidic-lite
|
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
|
|
|
|
(
|
2021-09-18 10:52:07 +00:00
|
|
|
cd TTS/tts/utils/monotonic_align
|
2021-07-21 07:28:18 +00:00
|
|
|
${python3.interpreter} setup.py install --prefix=$out
|
2021-02-05 17:12:51 +00:00
|
|
|
)
|
2020-12-03 08:41:04 +00:00
|
|
|
'';
|
|
|
|
|
2021-07-21 07:28:18 +00:00
|
|
|
checkInputs = with python3.pkgs; [
|
2021-05-20 23:08:51 +00:00
|
|
|
pytest-sugar
|
|
|
|
pytestCheckHook
|
|
|
|
];
|
2020-12-03 08:41:04 +00:00
|
|
|
|
|
|
|
disabledTests = [
|
|
|
|
# RuntimeError: fft: ATen not compiled with MKL support
|
|
|
|
"test_torch_stft"
|
|
|
|
"test_stft_loss"
|
|
|
|
"test_multiscale_stft_loss"
|
2021-05-20 23:08:51 +00:00
|
|
|
# Requires network acccess to download models
|
|
|
|
"test_synthesize"
|
2022-01-03 16:56:52 +00:00
|
|
|
"test_run_all_models"
|
2020-12-03 08:41:04 +00:00
|
|
|
];
|
|
|
|
|
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-05-20 23:08:51 +00:00
|
|
|
export PATH=$out/bin:$PATH
|
|
|
|
|
|
|
|
# numba tries to write to HOME directory
|
|
|
|
export HOME=$TMPDIR
|
|
|
|
|
|
|
|
for file in $(grep -rl 'python TTS/bin' tests); do
|
|
|
|
substituteInPlace "$file" \
|
|
|
|
--replace "python TTS/bin" "${python3.interpreter} $out/lib/${python3.libPrefix}/site-packages/TTS/bin"
|
|
|
|
done
|
2021-02-05 17:12:51 +00:00
|
|
|
'';
|
|
|
|
|
2021-04-17 00:35:05 +00:00
|
|
|
disabledTestPaths = [
|
2021-02-05 17:12:51 +00:00
|
|
|
# requires tensorflow
|
2021-05-20 23:08:51 +00:00
|
|
|
"tests/vocoder_tests/test_vocoder_tf_pqmf.py"
|
|
|
|
"tests/vocoder_tests/test_vocoder_tf_melgan_generator.py"
|
2021-06-28 23:13:55 +00:00
|
|
|
"tests/tts_tests/test_tacotron2_tf_model.py"
|
2021-05-20 23:08:51 +00:00
|
|
|
# RuntimeError: fft: ATen not compiled with MKL support
|
2021-08-12 14:41:47 +00:00
|
|
|
"tests/tts_tests/test_vits_train.py"
|
2021-05-20 23:08:51 +00:00
|
|
|
"tests/vocoder_tests/test_fullband_melgan_train.py"
|
|
|
|
"tests/vocoder_tests/test_hifigan_train.py"
|
|
|
|
"tests/vocoder_tests/test_melgan_train.py"
|
|
|
|
"tests/vocoder_tests/test_multiband_melgan_train.py"
|
|
|
|
"tests/vocoder_tests/test_parallel_wavegan_train.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 ];
|
|
|
|
};
|
|
|
|
}
|