2020-06-08 14:38:55 +00:00
|
|
|
{ lib
|
2021-07-26 18:41:47 +00:00
|
|
|
, python3
|
2020-06-08 14:38:55 +00:00
|
|
|
, fetchFromGitHub
|
2022-03-07 20:46:50 +00:00
|
|
|
, espeak-ng
|
2023-04-04 10:16:49 +00:00
|
|
|
, tts
|
2020-06-08 14:38:55 +00:00
|
|
|
}:
|
|
|
|
|
2022-02-13 13:36:52 +00:00
|
|
|
let
|
|
|
|
python = python3.override {
|
2024-08-02 11:10:35 +00:00
|
|
|
self = python;
|
2022-02-13 13:36:52 +00:00
|
|
|
packageOverrides = self: super: {
|
2023-05-16 13:48:42 +00:00
|
|
|
torch = super.torch-bin;
|
|
|
|
torchvision = super.torchvision-bin;
|
2023-09-23 23:15:25 +00:00
|
|
|
tensorflow = super.tensorflow-bin;
|
2022-02-13 13:36:52 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
in
|
|
|
|
python.pkgs.buildPythonApplication rec {
|
2020-06-08 14:38:55 +00:00
|
|
|
pname = "tts";
|
2023-11-17 01:44:06 +00:00
|
|
|
version = "0.20.2";
|
|
|
|
pyproject = true;
|
2021-07-02 12:00:46 +00:00
|
|
|
|
2020-06-08 14:38:55 +00:00
|
|
|
src = fetchFromGitHub {
|
2021-04-15 01:35:41 +00:00
|
|
|
owner = "coqui-ai";
|
2020-06-08 14:38:55 +00:00
|
|
|
repo = "TTS";
|
2023-01-29 01:36:44 +00:00
|
|
|
rev = "refs/tags/v${version}";
|
2023-11-17 01:44:06 +00:00
|
|
|
hash = "sha256-1nlSf15IEX1qKfDtR6+jQqskjxIuzaIWatkj9Z1fh8Y=";
|
2020-06-08 14:38:55 +00:00
|
|
|
};
|
|
|
|
|
2022-01-24 19:13:21 +00:00
|
|
|
postPatch = let
|
|
|
|
relaxedConstraints = [
|
2023-04-22 16:57:48 +00:00
|
|
|
"bnunicodenormalizer"
|
2022-07-09 17:44:58 +00:00
|
|
|
"cython"
|
2022-01-24 19:13:21 +00:00
|
|
|
"gruut"
|
2022-08-29 22:01:17 +00:00
|
|
|
"inflect"
|
2022-01-24 19:13:21 +00:00
|
|
|
"librosa"
|
|
|
|
"mecab-python3"
|
|
|
|
"numba"
|
|
|
|
"numpy"
|
2022-03-07 20:46:50 +00:00
|
|
|
"unidic-lite"
|
2023-03-02 17:42:17 +00:00
|
|
|
"trainer"
|
2022-01-24 19:13:21 +00:00
|
|
|
];
|
|
|
|
in ''
|
|
|
|
sed -r -i \
|
|
|
|
${lib.concatStringsSep "\n" (map (package:
|
2023-09-03 14:30:37 +00:00
|
|
|
''-e 's/${package}\s*[<>=]+.+/${package}/g' \''
|
2022-01-24 19:13:21 +00:00
|
|
|
) relaxedConstraints)}
|
|
|
|
requirements.txt
|
2023-09-03 14:30:37 +00:00
|
|
|
|
|
|
|
sed -r -i \
|
|
|
|
${lib.concatStringsSep "\n" (map (package:
|
|
|
|
''-e 's/${package}\s*[<>=]+[^"]+/${package}/g' \''
|
|
|
|
) relaxedConstraints)}
|
|
|
|
pyproject.toml
|
2023-01-22 14:51:49 +00:00
|
|
|
# only used for notebooks and visualization
|
|
|
|
sed -r -i -e '/umap-learn/d' requirements.txt
|
2020-06-08 14:38:55 +00:00
|
|
|
'';
|
|
|
|
|
2022-02-13 13:36:52 +00:00
|
|
|
nativeBuildInputs = with python.pkgs; [
|
2021-05-14 18:26:52 +00:00
|
|
|
cython
|
2023-11-17 01:44:06 +00:00
|
|
|
numpy
|
2023-01-29 01:36:44 +00:00
|
|
|
packaging
|
2023-11-17 01:44:06 +00:00
|
|
|
setuptools
|
2021-05-14 18:26:52 +00:00
|
|
|
];
|
2020-06-08 14:38:55 +00:00
|
|
|
|
2022-02-13 13:36:52 +00:00
|
|
|
propagatedBuildInputs = with python.pkgs; [
|
2021-06-04 12:46:55 +00:00
|
|
|
anyascii
|
2023-04-22 16:57:48 +00:00
|
|
|
bangla
|
|
|
|
bnnumerizer
|
|
|
|
bnunicodenormalizer
|
2021-05-19 13:14:29 +00:00
|
|
|
coqpit
|
2023-05-16 13:48:42 +00:00
|
|
|
einops
|
2023-06-29 01:26:55 +00:00
|
|
|
encodec
|
2021-04-15 01:35:41 +00:00
|
|
|
flask
|
2021-08-11 12:53:10 +00:00
|
|
|
fsspec
|
2022-11-17 13:27:35 +00:00
|
|
|
g2pkk
|
2020-06-08 14:38:55 +00:00
|
|
|
gdown
|
2022-01-24 19:13:21 +00:00
|
|
|
gruut
|
2021-04-15 01:35:41 +00:00
|
|
|
inflect
|
2022-11-17 13:27:35 +00:00
|
|
|
jamo
|
2021-04-15 01:35:41 +00:00
|
|
|
jieba
|
2023-05-16 13:48:42 +00:00
|
|
|
k-diffusion
|
2021-04-15 01:35:41 +00:00
|
|
|
librosa
|
|
|
|
matplotlib
|
2021-06-04 12:46:55 +00:00
|
|
|
mecab-python3
|
2022-11-17 13:27:35 +00:00
|
|
|
nltk
|
2021-05-19 13:14:29 +00:00
|
|
|
numba
|
2023-01-29 01:36:44 +00:00
|
|
|
packaging
|
2021-05-14 18:26:52 +00:00
|
|
|
pandas
|
2021-04-15 01:35:41 +00:00
|
|
|
pypinyin
|
2020-06-08 14:38:55 +00:00
|
|
|
pysbd
|
2021-04-15 01:35:41 +00:00
|
|
|
scipy
|
|
|
|
soundfile
|
2021-06-04 12:46:55 +00:00
|
|
|
tensorflow
|
2022-08-30 15:41:22 +00:00
|
|
|
torch-bin
|
2022-01-24 19:13:21 +00:00
|
|
|
torchaudio-bin
|
2021-04-15 01:35:41 +00:00
|
|
|
tqdm
|
2022-11-16 17:34:13 +00:00
|
|
|
trainer
|
2023-05-16 13:48:42 +00:00
|
|
|
transformers
|
2021-06-04 12:46:55 +00:00
|
|
|
unidic-lite
|
2022-01-24 19:13:21 +00:00
|
|
|
webrtcvad
|
2020-06-08 14:38:55 +00: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 02:56:09 +00:00
|
|
|
cd TTS/tts/utils/monotonic_align
|
2023-11-06 01:38:24 +00:00
|
|
|
${python.pythonOnBuildForHost.interpreter} setup.py install --prefix=$out
|
2021-01-16 13:11:12 +00:00
|
|
|
)
|
2020-06-08 14:38:55 +00:00
|
|
|
'';
|
|
|
|
|
2023-04-04 10:16:49 +00:00
|
|
|
# tests get stuck when run in nixpkgs-review, tested in passthru
|
|
|
|
doCheck = false;
|
|
|
|
passthru.tests.pytest = tts.overridePythonAttrs (_: { doCheck = true; });
|
|
|
|
|
2023-01-21 12:00:00 +00:00
|
|
|
nativeCheckInputs = with python.pkgs; [
|
2022-03-07 20:46:50 +00:00
|
|
|
espeak-ng
|
2021-05-14 18:26:52 +00:00
|
|
|
pytestCheckHook
|
|
|
|
];
|
2020-06-08 14:38:55 +00: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 18:26:52 +00:00
|
|
|
export PATH=$out/bin:$PATH
|
|
|
|
|
|
|
|
# numba tries to write to HOME directory
|
|
|
|
export HOME=$TMPDIR
|
2021-05-19 13:14:29 +00:00
|
|
|
|
|
|
|
for file in $(grep -rl 'python TTS/bin' tests); do
|
|
|
|
substituteInPlace "$file" \
|
2023-03-24 00:30:46 +00:00
|
|
|
--replace "python TTS/bin" "${python.interpreter} $out/${python.sitePackages}/TTS/bin"
|
2021-05-19 13:14:29 +00: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
|
2022-11-17 13:27:35 +00:00
|
|
|
"test_korean_text_to_phonemes"
|
|
|
|
"test_models_offset_0_step_3"
|
|
|
|
"test_models_offset_1_step_3"
|
|
|
|
"test_models_offset_2_step_3"
|
2022-03-07 20:46:50 +00:00
|
|
|
"test_run_all_models"
|
2022-11-17 13:27:35 +00:00
|
|
|
"test_synthesize"
|
2023-02-10 18:11:43 +00:00
|
|
|
"test_voice_cloning"
|
2022-11-17 13:27:35 +00:00
|
|
|
"test_voice_conversion"
|
2023-01-29 01:36:44 +00:00
|
|
|
"test_multi_speaker_multi_lingual_model"
|
|
|
|
"test_single_speaker_model"
|
2022-03-07 20:46:50 +00:00
|
|
|
# Mismatch between phonemes
|
|
|
|
"test_text_to_ids_phonemes_with_eos_bos_and_blank"
|
|
|
|
# Takes too long
|
|
|
|
"test_parametrized_wavernn_dataset"
|
|
|
|
];
|
|
|
|
|
2021-04-15 01:35:41 +00:00
|
|
|
disabledTestPaths = [
|
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"
|
2023-02-10 18:11:43 +00:00
|
|
|
"tests/tts_tests/test_fastspeech_2_speaker_emb_train.py"
|
|
|
|
"tests/tts_tests/test_fastspeech_2_train.py"
|
2022-03-07 20:46:50 +00:00
|
|
|
"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"
|
2023-02-10 18:11:43 +00:00
|
|
|
"tests/tts_tests/test_neuralhmm_tts_train.py"
|
2023-01-29 01:36:44 +00:00
|
|
|
"tests/tts_tests/test_overflow_train.py"
|
2022-03-07 20:46:50 +00:00
|
|
|
"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 12:53:10 +00: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 13:14:29 +00: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"
|
2023-03-22 03:34:47 +00:00
|
|
|
# only a feed forward test, but still takes too long
|
|
|
|
"tests/tts_tests/test_overflow.py"
|
2021-01-16 13:11:12 +00:00
|
|
|
];
|
|
|
|
|
2023-03-02 17:42:17 +00:00
|
|
|
passthru = {
|
|
|
|
inherit python;
|
|
|
|
};
|
|
|
|
|
2020-06-08 14:38:55 +00:00
|
|
|
meta = with lib; {
|
2021-04-15 01:35:41 +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-06-08 14:38:55 +00:00
|
|
|
license = licenses.mpl20;
|
2022-03-07 20:46:50 +00:00
|
|
|
maintainers = teams.tts.members;
|
2024-04-08 13:58:28 +00:00
|
|
|
broken = true; # added 2024-04-08
|
2020-06-08 14:38:55 +00:00
|
|
|
};
|
|
|
|
}
|