Unbreak tts (#366756)

This commit is contained in:
Jörg Thalheim
2024-12-23 00:20:52 +01:00
committed by GitHub
8 changed files with 112 additions and 82 deletions
+4 -4
View File
@@ -123,10 +123,10 @@ in
User = "tts";
StateDirectory = "tts";
ExecStart =
"${pkgs.tts}/bin/tts-server --port ${toString options.port}"
+ optionalString (options.model != null) " --model_name ${options.model}"
+ optionalString (options.useCuda) " --use_cuda"
+ (concatMapStringsSep " " escapeShellArgs options.extraArgs);
"${pkgs.tts}/bin/tts-server --port ${toString options.port} "
+ optionalString (options.model != null) "--model_name ${options.model} "
+ optionalString (options.useCuda) "--use_cuda "
+ (escapeShellArgs options.extraArgs);
CapabilityBoundingSet = "";
DeviceAllow =
if options.useCuda then
+21 -29
View File
@@ -17,15 +17,15 @@ let
};
in
python.pkgs.buildPythonApplication rec {
pname = "tts";
version = "0.20.2";
pname = "coqui-tts";
version = "0.25.1";
pyproject = true;
src = fetchFromGitHub {
owner = "coqui-ai";
repo = "TTS";
owner = "idiap";
repo = "coqui-ai-TTS";
rev = "refs/tags/v${version}";
hash = "sha256-1nlSf15IEX1qKfDtR6+jQqskjxIuzaIWatkj9Z1fh8Y=";
hash = "sha256-5w1Y9wdoJ+EV/WBwK3nqyY60NEsMjQsfE4g+sJB7VwQ=";
};
postPatch =
@@ -41,22 +41,16 @@ python.pkgs.buildPythonApplication rec {
"numpy"
"unidic-lite"
"trainer"
"spacy\\[ja\\]"
"transformers"
];
in
''
sed -r -i \
${lib.concatStringsSep "\n" (
map (package: ''-e 's/${package}\s*[<>=]+.+/${package}/g' \'') relaxedConstraints
)}
requirements.txt
sed -r -i \
${lib.concatStringsSep "\n" (
map (package: ''-e 's/${package}\s*[<>=]+[^"]+/${package}/g' \'') relaxedConstraints
)}
pyproject.toml
# only used for notebooks and visualization
sed -r -i -e '/umap-learn/d' requirements.txt
'';
nativeBuildInputs = with python.pkgs; [
@@ -64,6 +58,7 @@ python.pkgs.buildPythonApplication rec {
numpy
packaging
setuptools
hatchling
];
propagatedBuildInputs = with python.pkgs; [
@@ -102,15 +97,12 @@ python.pkgs.buildPythonApplication rec {
transformers
unidic-lite
webrtcvad
spacy
monotonic-alignment-search
];
postInstall = ''
cp -r TTS/server/templates/ $out/${python.sitePackages}/TTS/server
# cython modules are not installed for some reasons
(
cd TTS/tts/utils/monotonic_align
${python.pythonOnBuildForHost.interpreter} setup.py install --prefix=$out
)
'';
# tests get stuck when run in nixpkgs-review, tested in passthru
@@ -161,14 +153,14 @@ python.pkgs.buildPythonApplication rec {
"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_fastspeech_2_speaker_emb_train.py"
"tests/tts_tests/test_fastspeech_2_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_tests2/test_align_tts_train.py"
"tests/tts_tests2/test_fast_pitch_speaker_emb_train.py"
"tests/tts_tests2/test_fast_pitch_train.py"
"tests/tts_tests2/test_fastspeech_2_speaker_emb_train.py"
"tests/tts_tests2/test_fastspeech_2_train.py"
"tests/tts_tests2/test_glow_tts_d-vectors_train.py"
"tests/tts_tests2/test_glow_tts_speaker_emb_train.py"
"tests/tts_tests2/test_glow_tts_train.py"
"tests/tts_tests/test_neuralhmm_tts_train.py"
"tests/tts_tests/test_overflow_train.py"
"tests/tts_tests/test_speedy_speech_train.py"
@@ -197,11 +189,11 @@ python.pkgs.buildPythonApplication rec {
};
meta = with lib; {
homepage = "https://github.com/coqui-ai/TTS";
changelog = "https://github.com/coqui-ai/TTS/releases/tag/v${version}";
homepage = "https://github.com/idiap/coqui-ai-TTS";
changelog = "https://github.com/idiap/coqui-ai-TTS/releases/tag/v${version}";
description = "Deep learning toolkit for Text-to-Speech, battle-tested in research and production";
license = licenses.mpl20;
maintainers = teams.tts.members;
broken = true; # added 2024-04-08
broken = false;
};
}
@@ -4,22 +4,32 @@
fetchFromGitHub,
pythonAtLeast,
pytestCheckHook,
hatchling,
typing-extensions,
}:
buildPythonPackage rec {
pname = "coqpit";
version = "0.0.17";
format = "setuptools";
pname = "coqpit-config";
version = "0.1.2";
format = "pyproject";
src = fetchFromGitHub {
owner = "coqui-ai";
repo = pname;
owner = "idiap";
repo = "coqui-ai-coqpit";
rev = "refs/tags/v${version}";
hash = "sha256-FY3PYd8dY5HFKkhD6kBzPt0k1eFugdqsO3yIN4oDk3E=";
hash = "sha256-3LZxoj2aFTpezakBymogkNPCaEBBaaUmyIa742cSMgU=";
};
nativeCheckInputs = [ pytestCheckHook ];
nativeBuildInputs = [
hatchling
];
propagatedBuildInputs = [
typing-extensions
];
pythonImportsCheck = [
"coqpit"
"coqpit.coqpit"
@@ -35,7 +45,7 @@ buildPythonPackage rec {
longDescription = ''
Simple, light-weight and no dependency config handling through python data classes with to/from JSON serialization/deserialization.
'';
homepage = "https://github.com/coqui-ai/coqpit";
homepage = "https://github.com/idiap/coqui-ai-coqpit";
license = licenses.mit;
maintainers = teams.tts.members;
};
@@ -0,0 +1,48 @@
{
lib,
buildPythonPackage,
fetchFromGitHub,
# build-system
setuptools,
cython,
numpy_2,
# dependencies
torch,
}:
buildPythonPackage rec {
pname = "monotonic-alignment-search";
version = "0.1.1";
pyproject = true;
src = fetchFromGitHub {
owner = "eginhard";
repo = "monotonic_alignment_search";
rev = "refs/tags/v${version}";
hash = "sha256-qBkJKED0KVArhzmhZo8UuWQ55XMMBgvKM3xOwiPVwKU=";
};
build-system = [
setuptools
cython
numpy_2
];
dependencies = [
torch
];
pytestFlagsArray = [ "tests" ];
pythonImportsCheck = [ "monotonic_alignment_search" ];
meta = {
homepage = "https://github.com/eginhard/monotonic_alignment_search";
description = "Monotonically align text and speech";
changelog = "https://github.com/eginhard/monotonic_alignment_search/releases/tag/v${version}";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ jbgi ];
};
}
@@ -4,6 +4,8 @@
fetchFromGitHub,
fetchpatch,
hatchling,
coqpit,
fsspec,
torch,
@@ -17,32 +19,24 @@
}:
let
pname = "trainer";
version = "0.0.36";
pname = "coqui-tts-trainer";
version = "0.2.0";
in
buildPythonPackage {
inherit pname version;
format = "pyproject";
src = fetchFromGitHub {
owner = "coqui-ai";
repo = "Trainer";
owner = "idiap";
repo = "coqui-ai-Trainer";
rev = "refs/tags/v${version}";
hash = "sha256-z6TOzWqE3NytkdG3nUzh9GpFVGQEXFyzSQ8gvdB4wiw=";
hash = "sha256-zm8BTfXvfwuWpmHFcSxuu+/V4bKanSBU2dniQboVdLY=";
};
patches = [
(fetchpatch {
name = "add-support-for-python312.patch";
hash = "sha256-V5RPn/2pGKzQrf/SIRU3imo6nBhpBEJpI7HsFYbVZj4=";
url = "https://github.com/coqui-ai/Trainer/commit/0278012c7e6f5972b656d11757add4ab89f6d272.patch";
})
nativeBuildInputs = [
hatchling
];
postPatch = ''
sed -i 's/^protobuf.*/protobuf/' requirements.txt
'';
propagatedBuildInputs = [
coqpit
fsspec
@@ -65,8 +59,8 @@ buildPythonPackage {
meta = with lib; {
description = "General purpose model trainer, as flexible as it gets";
homepage = "https://github.com/coqui-ai/Trainer";
changelog = "https://github.com/coqui-ai/Trainer/releases/tag/v${version}";
homepage = "https://github.com/idiap/coqui-ai-Trainer";
changelog = "https://github.com/idiap/coqui-ai-Trainer/releases/tag/v${version}";
license = licenses.asl20;
maintainers = teams.tts.members;
};
+4 -25
View File
@@ -49,31 +49,10 @@ buildPythonPackage rec {
dontStrip = true;
# If this breaks, consider replacing with "${cuda_nvcc}/bin/ptxas"
postFixup =
''
chmod +x "$out/${python.sitePackages}/triton/third_party/cuda/bin/ptxas"
''
+ (
let
# Bash was getting weird without linting,
# but basically upstream contains [cc, ..., "-lcuda", ...]
# and we replace it with [..., "-lcuda", "-L/run/opengl-driver/lib", "-L$stubs", ...]
old = [ "-lcuda" ];
new = [
"-lcuda"
"-L${addDriverRunpath.driverLink}"
"-L${cudaPackages.cuda_cudart}/lib/stubs/"
];
quote = x: ''"${x}"'';
oldStr = lib.concatMapStringsSep ", " quote old;
newStr = lib.concatMapStringsSep ", " quote new;
in
''
substituteInPlace $out/${python.sitePackages}/triton/common/build.py \
--replace '${oldStr}' '${newStr}'
''
);
postFixup = ''
mkdir -p $out/${python.sitePackages}/triton/third_party/cuda/bin/
ln -s ${cudaPackages.cuda_nvcc}/bin/ptxas $out/${python.sitePackages}/triton/third_party/cuda/bin/
'';
meta = with lib; {
description = "Language and compiler for custom Deep Learning operations";
@@ -285,6 +285,9 @@ buildPythonPackage rec {
"test_parse_project_path"
"test_translates_azure_err_to_normal_err"
# tests assertion if filesystem is compressed
"test_artifact_file_cache_cleanup"
# Tries to access a storage disk but there are none in the sandbox
# psutil.test_disk_out() returns None
"test_disk_in"
+4
View File
@@ -8389,6 +8389,10 @@ self: super: with self; {
monotonic = callPackage ../development/python-modules/monotonic { };
monotonic-alignment-search =
callPackage ../development/python-modules/monotonic-alignment-search
{ };
monty = callPackage ../development/python-modules/monty { };
monzopy = callPackage ../development/python-modules/monzopy { };