diff --git a/pkgs/development/python-modules/larynx/default.nix b/pkgs/development/python-modules/larynx/default.nix new file mode 100644 index 0000000000000..41cd73139068c --- /dev/null +++ b/pkgs/development/python-modules/larynx/default.nix @@ -0,0 +1,114 @@ +{ lib +, buildPythonPackage +, fetchPypi +, pythonOlder + +, openblas +, gomp +, libatomic_ops + +, dataclasses-json +, gruut +, numpy +, onnxruntime +, phonemes2ids +, python-pidfile +, psutil +, pytorch +, tqdm +}: + +buildPythonPackage rec { + pname = "larynx"; + version = "1.1.0"; + + voices_version = "2021-03-28"; + + disabled = pythonOlder "3.7"; + + src = fetchPypi { + inherit pname version; + sha256 = "4f073ce1ef1ae0ce806e896dfee9fd242c287964eeaf46c9587ad33d5c4efc83"; + }; + + # TODO: add voices to package? (https://github.com/rhasspy/larynx/releases/tag/2021-03-28) + voices = [ + "de-de_eva_k-glow_tts" + "de-de_karlsson-glow_tts" + "de-de_pavoque-glow_tts" + "de-de_rebecca_braunert_plunkett-glow_tts" + "de-de_thorsten-glow_tts" + "en-us_blizzard_fls-glow_tts" + "en-us_cmu_aew-glow_tts" + "en-us_cmu_ahw-glow_tts" + "en-us_cmu_aup-glow_tts" + "en-us_cmu_bdl-glow_tts" + "en-us_cmu_clb-glow_tts" + "en-us_cmu_eey-glow_tts" + "en-us_cmu_fem-glow_tts" + "en-us_cmu_jmk-glow_tts" + "en-us_cmu_ksp-glow_tts" + "en-us_cmu_ljm-glow_tts" + "en-us_cmu_lnh-glow_tts" + "en-us_cmu_rms-glow_tts" + "en-us_cmu_rxr-glow_tts" + "en-us_cmu_slp-glow_tts" + "en-us_cmu_slt-glow_tts" + "en-us_ek-glow_tts" + "en-us_harvard-glow_tts" + "en-us_kathleen-glow_tts" + "en-us_ljspeech-glow_tts" + "en-us_mary_ann-glow_tts" + "es-es_carlfm-glow_tts" + "es-es_karen_savage-glow_tts" + "fr-fr_gilles_le_blanc-glow_tts" + "fr-fr_siwis-glow_tts" + "fr-fr_tom-glow_tts" + "it-it_lisa-glow_tts" + "it-it_riccardo_fasol-glow_tts" + "nl_bart_de_leeuw-glow_tts" + "nl_flemishguy-glow_tts" + "nl_rdh-glow_tts" + "ru-ru_hajdurova-glow_tts" + "ru-ru_minaev-glow_tts" + "ru-ru_nikolaev-glow_tts" + "sv-se_talesyntese-glow_tts" + "sw_biblia_takatifu-glow_tts" + "en-us_southern_english_female-glow_tts" + "en-us_southern_english_male-glow_tts" + "en-us_blizzard_lessac-glow_tts" + "en-us_scottish_english_male-glow_tts" + "en-us_northern_english_male-glow_tts" + "en-us_judy_bieber-glow_tts" + "de-de_hokuspokus-glow_tts" + "de-de_kerstin-glow_tts" + "nl_nathalie-glow_tts" + "en-us_glados-glow_tts" + ]; + + propagatedBuildInputs = [ + openblas + gomp + libatomic_ops + dataclasses-json + gruut + numpy + onnxruntime + phonemes2ids + python-pidfile + psutil + pytorch + tqdm + ]; + + patches = [ + ./remove-server.patch + ]; + + meta = with lib; { + description = "Neural text to speech system using the International Phonetic Alphabet"; + homepage = https://github.com/rhasspy/larynx; + license = licenses.mit; + maintainers = [ maintainers.tilcreator ]; + }; +} diff --git a/pkgs/development/python-modules/larynx/remove-server.patch b/pkgs/development/python-modules/larynx/remove-server.patch new file mode 100644 index 0000000000000..113181945edbc --- /dev/null +++ b/pkgs/development/python-modules/larynx/remove-server.patch @@ -0,0 +1,41 @@ +diff --git a/requirements.txt b/requirements.txt +index 9b091c4..9269d34 100644 +--- a/requirements.txt ++++ b/requirements.txt +@@ -1,12 +1,9 @@ + dataclasses-json~=0.5.0 +-gruut[de,es,fr,it,nl,ru,sv,sw]~=2.1.0 ++gruut + numpy>=1.20.0 +-onnxruntime>=1.6.0,<2.0 +-phonemes2ids~=1.0.0 ++onnxruntime ++phonemes2ids + python-pidfile~=3.0.0 + psutil~=5.8.0 +-quart~=0.15.0 +-quart-cors~=0.5.0 +-swagger-ui-py~=21.9.28 + torch~=1.8.0 + tqdm~=4.48.2 +diff --git a/setup.py b/setup.py +index 85fd07e..ad0e460 100644 +--- a/setup.py ++++ b/setup.py +@@ -28,7 +28,7 @@ with open(version_path, "r", encoding="utf-8") as version_file: + + data_files = [ + str(f.relative_to(module_dir)) +- for d in ["css", "templates", "wav"] ++ for d in ["wav"] + for f in (module_dir / d).rglob("*") + if f.is_file() + ] +@@ -48,7 +48,6 @@ setuptools.setup( + entry_points={ + "console_scripts": [ + "larynx = larynx.__main__:main", +- "larynx-server = larynx.server.__main__:main", + ] + }, + classifiers=[ diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index b5868329de8e0..16543ad36798f 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -6322,6 +6322,8 @@ in { phonenumbers = callPackage ../development/python-modules/phonenumbers { }; + larynx = callPackage ../development/python-modules/larynx { }; + micloud = callPackage ../development/python-modules/micloud { }; netmap = callPackage ../development/python-modules/netmap { };