2020-06-08 15:38:55 +01:00
|
|
|
{ lib
|
2021-07-26 19:41:47 +01:00
|
|
|
, python3
|
2020-06-08 15:38:55 +01:00
|
|
|
, fetchFromGitHub
|
2022-03-07 20:46:50 +00:00
|
|
|
, espeak-ng
|
2020-06-08 15:38:55 +01:00
|
|
|
}:
|
|
|
|
|
2021-01-16 13:11:12 +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-06-08 15:38:55 +01:00
|
|
|
#
|
2021-04-16 08:33:04 +01:00
|
|
|
# If you upgrade from an old version you may have to delete old models from ~/.local/share/tts
|
|
|
|
#
|
2020-06-08 15:38:55 +01:00
|
|
|
# For now, for deployment check the systemd unit in the pull request:
|
|
|
|
# https://github.com/NixOS/nixpkgs/pull/103851#issue-521121136
|
|
|
|
|
2022-02-13 13:36:52 +00:00
|
|
|
let
|
|
|
|
python = python3.override {
|
|
|
|
packageOverrides = self: super: {
|
|
|
|
# API breakage with 0.9.0
|
|
|
|
# TypeError: mel() takes 0 positional arguments but 2 positional arguments (and 3 keyword-only arguments) were given
|
|
|
|
librosa = super.librosa.overridePythonAttrs (oldAttrs: rec {
|
|
|
|
version = "0.8.1";
|
|
|
|
src = oldAttrs.src.override {
|
|
|
|
inherit version;
|
|
|
|
sha256 = "c53d05e768ae4a3e553ae21c2e5015293e5efbfd5c12d497f1104cb519cca6b3";
|
|
|
|
};
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
in
|
|
|
|
python.pkgs.buildPythonApplication rec {
|
2020-06-08 15:38:55 +01:00
|
|
|
pname = "tts";
|
2022-06-28 06:41:19 +01:00
|
|
|
version = "0.7.1";
|
2022-01-24 19:13:21 +00:00
|
|
|
format = "setuptools";
|
2021-07-02 13:00:46 +01:00
|
|
|
|
2020-06-08 15:38:55 +01:00
|
|
|
src = fetchFromGitHub {
|
2021-04-15 02:35:41 +01:00
|
|
|
owner = "coqui-ai";
|
2020-06-08 15:38:55 +01:00
|
|
|
repo = "TTS";
|
2021-04-15 02:35:41 +01:00
|
|
|
rev = "v${version}";
|
2022-06-28 06:41:19 +01:00
|
|
|
sha256 = "sha256-ch+711soRfZj1egyaF0+6NrUJtf7JqfZuxQ4eDf1zas=";
|
2020-06-08 15:38:55 +01:00
|
|
|
};
|
|
|
|
|
2022-01-24 19:13:21 +00:00
|
|
|
postPatch = let
|
|
|
|
relaxedConstraints = [
|
2022-07-09 18:44:58 +01:00
|
|
|
"cython"
|
2022-01-24 19:13:21 +00:00
|
|
|
"gruut"
|
|
|
|
"librosa"
|
|
|
|
"mecab-python3"
|
|
|
|
"numba"
|
|
|
|
"numpy"
|
|
|
|
"umap-learn"
|
2022-03-07 20:46:50 +00:00
|
|
|
"unidic-lite"
|
2022-06-28 06:41:19 +01:00
|
|
|
"pyworld"
|
2022-01-24 19:13:21 +00:00
|
|
|
];
|
|
|
|
in ''
|
|
|
|
sed -r -i \
|
|
|
|
${lib.concatStringsSep "\n" (map (package:
|
|
|
|
''-e 's/${package}.*[<>=]+.*/${package}/g' \''
|
|
|
|
) relaxedConstraints)}
|
|
|
|
requirements.txt
|
2022-03-23 02:56:47 +00:00
|
|
|
sed -i '/tensorboardX/d' requirements.txt
|
2020-06-08 15:38:55 +01:00
|
|
|
'';
|
|
|
|
|
2022-02-13 13:36:52 +00:00
|
|
|
nativeBuildInputs = with python.pkgs; [
|
2021-05-14 19:26:52 +01:00
|
|
|
cython
|
|
|
|
];
|
2020-06-08 15:38:55 +01:00
|
|
|
|
2022-02-13 13:36:52 +00:00
|
|
|
propagatedBuildInputs = with python.pkgs; [
|
2021-06-04 13:46:55 +01:00
|
|
|
anyascii
|
2021-05-19 14:14:29 +01:00
|
|
|
coqpit
|
2022-03-07 20:46:50 +00:00
|
|
|
coqui-trainer
|
2021-04-15 02:35:41 +01:00
|
|
|
flask
|
2021-08-11 13:53:10 +01:00
|
|
|
fsspec
|
2020-06-08 15:38:55 +01:00
|
|
|
gdown
|
2022-01-24 19:13:21 +00:00
|
|
|
gruut
|
2021-04-15 02:35:41 +01:00
|
|
|
inflect
|
|
|
|
jieba
|
|
|
|
librosa
|
|
|
|
matplotlib
|
2021-06-04 13:46:55 +01:00
|
|
|
mecab-python3
|
2021-05-19 14:14:29 +01:00
|
|
|
numba
|
2021-05-14 19:26:52 +01:00
|
|
|
pandas
|
2021-04-15 02:35:41 +01:00
|
|
|
pypinyin
|
2020-06-08 15:38:55 +01:00
|
|
|
pysbd
|
2022-01-24 19:13:21 +00:00
|
|
|
pytorch-bin
|
2021-09-07 01:41:01 +01:00
|
|
|
pyworld
|
2021-04-15 02:35:41 +01:00
|
|
|
scipy
|
|
|
|
soundfile
|
2021-06-04 13:46:55 +01:00
|
|
|
tensorflow
|
2022-01-24 19:13:21 +00:00
|
|
|
torchaudio-bin
|
2021-04-15 02:35:41 +01:00
|
|
|
tqdm
|
|
|
|
umap-learn
|
2021-06-04 13:46:55 +01:00
|
|
|
unidic-lite
|
2022-01-24 19:13:21 +00:00
|
|
|
webrtcvad
|
2020-06-08 15:38:55 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
postInstall = ''
|
2022-03-07 20:46:50 +00:00
|
|
|
cp -r TTS/server/templates/ $out/${python.sitePackages}/TTS/server
|
2021-01-16 13:11:12 +00:00
|
|
|
# cython modules are not installed for some reasons
|
|
|
|
(
|
2021-09-14 03:56:09 +01:00
|
|
|
cd TTS/tts/utils/monotonic_align
|
2022-03-07 20:46:50 +00:00
|
|
|
${python.interpreter} setup.py install --prefix=$out
|
2021-01-16 13:11:12 +00:00
|
|
|
)
|
2020-06-08 15:38:55 +01:00
|
|
|
'';
|
|
|
|
|
2022-03-07 20:46:50 +00:00
|
|
|
checkInputs = with python.pkgs; [
|
|
|
|
espeak-ng
|
2021-05-14 19:26:52 +01:00
|
|
|
pytestCheckHook
|
|
|
|
];
|
2020-06-08 15:38:55 +01:00
|
|
|
|
2021-01-16 13:11:12 +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-14 19:26:52 +01:00
|
|
|
export PATH=$out/bin:$PATH
|
|
|
|
|
|
|
|
# numba tries to write to HOME directory
|
|
|
|
export HOME=$TMPDIR
|
2021-05-19 14:14:29 +01:00
|
|
|
|
|
|
|
for file in $(grep -rl 'python TTS/bin' tests); do
|
|
|
|
substituteInPlace "$file" \
|
2022-03-07 20:46:50 +00:00
|
|
|
--replace "python TTS/bin" "${python.interpreter} $out/lib/${python.libPrefix}/site-packages/TTS/bin"
|
2021-05-19 14:14:29 +01:00
|
|
|
done
|
2021-01-16 13:11:12 +00:00
|
|
|
'';
|
|
|
|
|
2022-03-07 20:46:50 +00:00
|
|
|
disabledTests = [
|
|
|
|
# Requires network acccess to download models
|
|
|
|
"test_synthesize"
|
|
|
|
"test_run_all_models"
|
|
|
|
# Mismatch between phonemes
|
|
|
|
"test_text_to_ids_phonemes_with_eos_bos_and_blank"
|
|
|
|
# Takes too long
|
|
|
|
"test_parametrized_wavernn_dataset"
|
2022-06-28 06:41:19 +01:00
|
|
|
|
|
|
|
# requires network
|
|
|
|
"test_voice_conversion"
|
2022-03-07 20:46:50 +00:00
|
|
|
];
|
|
|
|
|
2021-04-15 02:35:41 +01:00
|
|
|
disabledTestPaths = [
|
2022-05-29 08:49:30 +01:00
|
|
|
# Requires network acccess to download models
|
|
|
|
"tests/aux_tests/test_remove_silence_vad_script.py"
|
2022-03-07 20:46:50 +00:00
|
|
|
# phonemes mismatch between espeak-ng and gruuts phonemizer
|
|
|
|
"tests/text_tests/test_phonemizer.py"
|
|
|
|
# no training, it takes too long
|
|
|
|
"tests/aux_tests/test_speaker_encoder_train.py"
|
|
|
|
"tests/tts_tests/test_align_tts_train.py"
|
|
|
|
"tests/tts_tests/test_fast_pitch_speaker_emb_train.py"
|
|
|
|
"tests/tts_tests/test_fast_pitch_train.py"
|
|
|
|
"tests/tts_tests/test_glow_tts_d-vectors_train.py"
|
|
|
|
"tests/tts_tests/test_glow_tts_speaker_emb_train.py"
|
|
|
|
"tests/tts_tests/test_glow_tts_train.py"
|
|
|
|
"tests/tts_tests/test_speedy_speech_train.py"
|
|
|
|
"tests/tts_tests/test_tacotron2_d-vectors_train.py"
|
|
|
|
"tests/tts_tests/test_tacotron2_speaker_emb_train.py"
|
|
|
|
"tests/tts_tests/test_tacotron2_train.py"
|
|
|
|
"tests/tts_tests/test_tacotron_train.py"
|
|
|
|
"tests/tts_tests/test_vits_d-vectors_train.py"
|
|
|
|
"tests/tts_tests/test_vits_multilingual_speaker_emb_train.py"
|
|
|
|
"tests/tts_tests/test_vits_multilingual_train-d_vectors.py"
|
|
|
|
"tests/tts_tests/test_vits_speaker_emb_train.py"
|
2021-08-11 13:53:10 +01:00
|
|
|
"tests/tts_tests/test_vits_train.py"
|
2022-03-07 20:46:50 +00:00
|
|
|
"tests/vocoder_tests/test_wavegrad_train.py"
|
|
|
|
"tests/vocoder_tests/test_parallel_wavegan_train.py"
|
2021-05-19 14:14:29 +01:00
|
|
|
"tests/vocoder_tests/test_fullband_melgan_train.py"
|
|
|
|
"tests/vocoder_tests/test_hifigan_train.py"
|
|
|
|
"tests/vocoder_tests/test_multiband_melgan_train.py"
|
2022-03-07 20:46:50 +00:00
|
|
|
"tests/vocoder_tests/test_melgan_train.py"
|
|
|
|
"tests/vocoder_tests/test_wavernn_train.py"
|
2021-01-16 13:11:12 +00:00
|
|
|
];
|
|
|
|
|
2020-06-08 15:38:55 +01:00
|
|
|
meta = with lib; {
|
2021-04-15 02:35:41 +01: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-06-08 15:38:55 +01:00
|
|
|
license = licenses.mpl20;
|
2022-03-07 20:46:50 +00:00
|
|
|
maintainers = teams.tts.members;
|
2020-06-08 15:38:55 +01:00
|
|
|
};
|
|
|
|
}
|