Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

larynx: Init at 1.1.0 (WIP) #174131

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
135 changes: 135 additions & 0 deletions pkgs/development/libraries/onnxruntime/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
{ stdenv
, lib
, fetchFromGitHub
, fetchpatch
, runCommand
, patchutils
, pkg-config
, glibcLocales
, cmake
, python3
, libpng
, zlib
, eigen
, protobuf
, nsync
, flatbuffers
, howard-hinnant-date
, re2
, nlohmann_json
, boost
, oneDNN
}:

let
externals = {
pytorch_cpuinfo = fetchFromGitHub {
owner = "pytorch";
repo = "cpuinfo";
rev = "5916273f79a21551890fd3d56fc5375a78d1598d";
sha256 = "sha256-nXBnloVTuB+AVX59VDU/Wc+Dsx94o92YQuHp3jowx2A=";
};
onnx = fetchFromGitHub {
owner = "onnx";
repo = "onnx";
rev = "be76ca7148396176784ba8733133b9fb1186ea0d";
sha256 = "sha256-WwbfUijV67LL69RPgz+4m6EcwSyBNFweGUe0jkYRpbg=";
};
"SafeInt/safeint" = fetchFromGitHub {
owner = "dcleblanc";
repo = "SafeInt";
rev = "a104e0cf23be4fe848f7ef1f3e8996fe429b06bb";
sha256 = "sha256-LmQNIoHPqvl8asn86P33SDn+lCg8LpLfxUmoG9CGEdc=";
};
};
in
stdenv.mkDerivation rec {
pname = "onnxruntime";
version = "1.10.0";

src = fetchFromGitHub {
owner = "microsoft";
repo = "onnxruntime";
rev = "v${version}";
sha256 = "sha256-kWl0xrbTQL2FBSvpiqTcaj8uZV+ZV8gJJvj4/I0jopw=";
};

preConfigure = lib.concatStringsSep "\n" (lib.mapAttrsToList (name: path: ''
rmdir cmake/external/${name}
ln -s ${path} cmake/external/${name}
'') externals);

patches = [
# Exclude the flatbuffers change which breaks things
(runCommand "filtered" {
AUR_PATCH = fetchpatch {
name = "aur-build-fixes.patch";
url = "https://aur.archlinux.org/cgit/aur.git/plain/build-fixes.patch?h=python-onnxruntime&id=0185531906bda3a9aba93bbb0f3dcfeb0ae671ad";
sha256 = "sha256-bAJWThTbECQaoqDdkjHLneg6I1BshGMyCWaj7nfACvA=";
};
} ''
${patchutils}/bin/filterdiff --hunks 1,2 $AUR_PATCH > $out
'')
(fetchpatch {
name = "system-dnnl.patch";
url = "https://aur.archlinux.org/cgit/aur.git/plain/system-dnnl.diff?h=python-onnxruntime&id=0185531906bda3a9aba93bbb0f3dcfeb0ae671ad";
sha256 = "sha256-58RBrQnAWNtc/1pmFs+PkZ6qCsL1LfMY3P0exMKzotA=";
})
];

# TODO: build server, and move .so's to lib output
outputs = [ "out" "dev" ];

nativeBuildInputs = [
cmake
pkg-config
python3
];

buildInputs = [
libpng
zlib
protobuf
nsync
flatbuffers
howard-hinnant-date
re2
nlohmann_json
boost
oneDNN
];

cmakeDir = "../cmake";

cmakeFlags = [
"-Donnxruntime_PREFER_SYSTEM_LIB=ON"
"-Donnxruntime_BUILD_SHARED_LIB=ON"
"-Donnxruntime_ENABLE_LTO=ON"
"-Donnxruntime_BUILD_UNIT_TESTS=OFF"
"-Donnxruntime_USE_PREINSTALLED_EIGEN=ON"
"-Donnxruntime_USE_MPI=ON"
"-Deigen_SOURCE_PATH=${eigen.src}"
"-Donnxruntime_USE_DNNL=YES"
];

enableParallelBuilding = true;

meta = {
description = "Cross-platform, high performance scoring engine for ML models";
longDescription = ''
ONNX Runtime is a performance-focused complete scoring engine
for Open Neural Network Exchange (ONNX) models, with an open
extensible architecture to continually address the latest developments
in AI and Deep Learning. ONNX Runtime stays up to date with the ONNX
standard with complete implementation of all ONNX operators, and
supports all ONNX releases (1.2+) with both future and backwards
compatibility.
'';
homepage = "https://github.com/microsoft/onnxruntime";
changelog = "https://github.com/microsoft/onnxruntime/releases";
# https://github.com/microsoft/onnxruntime/blob/master/BUILD.md#architectures
platforms = lib.platforms.unix;
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ jonringer puffnfresh ];
};
}
114 changes: 114 additions & 0 deletions pkgs/development/python-modules/larynx/default.nix
Original file line number Diff line number Diff line change
@@ -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 ];
};
}
41 changes: 41 additions & 0 deletions pkgs/development/python-modules/larynx/remove-server.patch
Original file line number Diff line number Diff line change
@@ -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=[
21 changes: 21 additions & 0 deletions pkgs/development/python-modules/phonemes2ids/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{ lib
, buildPythonPackage
, fetchPypi
}:

buildPythonPackage rec {
pname = "phonemes2ids";
version = "1.2.2";

src = fetchPypi {
inherit pname version;
sha256 = "8e3e9e0723215c7187b56276bb053688a43851d8deb9948432e793262551c2ac";
};

meta = with lib; {
description = "Convert phonemes to integer ids";
homepage = https://github.com/rhasspy/phonemes2ids;
license = licenses.mit;
maintainers = [ maintainers.tilcreator ];
};
}
1 change: 0 additions & 1 deletion pkgs/top-level/aliases.nix
Original file line number Diff line number Diff line change
Expand Up @@ -927,7 +927,6 @@ mapAliases ({
odpdown = throw "odpdown has been removed because it lacks python3 support"; # Added 2022-04-25
ofp = throw "ofp is not compatible with odp-dpdk";
olifant = throw "olifant has been removed from nixpkgs, as it was unmaintained"; # Added 2021-08-05
onnxruntime = throw "onnxruntime has been removed due to poor maintainability"; # Added 2020-12-04
openbazaar = throw "openbazzar has been removed from nixpkgs as upstream has abandoned the project"; # Added 2022-01-06
openbazaar-client = throw "openbazzar-client has been removed from nixpkgs as upstream has abandoned the project"; # Added 2022-01-06
opencascade_oce = throw "'opencascade_oce' has been renamed to/replaced by 'opencascade'"; # Converted to throw 2022-02-22
Expand Down
2 changes: 2 additions & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4048,6 +4048,8 @@ with pkgs;

online-judge-tools = with python3.pkgs; toPythonApplication online-judge-tools;

onnxruntime = callPackage ../development/libraries/onnxruntime { };

xkbd = callPackage ../applications/misc/xkbd { };

libpsm2 = callPackage ../os-specific/linux/libpsm2 { };
Expand Down
4 changes: 4 additions & 0 deletions pkgs/top-level/python-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 { };
Expand All @@ -6338,6 +6340,8 @@ in {

pencompy = callPackage ../development/python-modules/pencompy { };

phonemes2ids = callPackage ../development/python-modules/phonemes2ids { };

pixcat = callPackage ../development/python-modules/pixcat { };

pyprecice = callPackage ../development/python-modules/pyprecice { };
Expand Down