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

tts: get mozilla tts working #1

Closed
wants to merge 8 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
28 changes: 28 additions & 0 deletions pkgs/applications/misc/visdom/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{ stdenv, fetchFromGitHub, python3Packages }:

python3Packages.buildPythonApplication rec {
pname = "visdom";
version = "0.1.8.9";

src = python3Packages.fetchPypi {
inherit pname version;
sha256 = "09kiczx2i5asqsv214fz7sx8wlyldgbqvxwrd0alhjn24cvx4fn7";
};

propagatedBuildInputs = with python3Packages; [
jsonpatch
pillow
pyzmq
requests
scipy
torchfile
tornado
websocket_client
];

meta = with stdenv.lib; {
homepage = "https://github.com/facebookresearch/visdom";
description = "A tool for visualizing live, rich data for Torch and Numpy";
license = licenses.cc-by-nc-40;
};
}
58 changes: 58 additions & 0 deletions pkgs/development/python-modules/phonemizer/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{ lib
, substituteAll
, buildPythonApplication
, fetchPypi
, python3Packages
, pkgs
, joblib
, segments
, attrs
, espeak-ng
, pytest
, pytestrunner
, pytestcov
}:

buildPythonApplication rec {
pname = "phonemizer";
version = "2.2";

src = fetchPypi {
inherit pname version;
sha256 = "16hpfgzvc6r6f8khjqr62hdwsa6vhv6sxphg0879i1jfyaq5008b";
};

postPatch = ''
sed -i -e '/\'pytest-runner\'/d setup.py
'';

patches = [
(substituteAll {
src = ./espeak-path.patch;
espeak = "${lib.getBin espeak-ng}/bin/espeak";
})
];

propagatedBuildInputs = [
joblib
segments
attrs
];

# tests fail due to missing festival
doCheck = false;

checkInputs = [
pytest
pytestrunner
pytestcov
# festival is not packaged in nixpkgs :(
];

meta = with lib; {
homepage = "https://github.com/bootphon/phonemizer";
description = "Simple text to phones converter for multiple languages";
license = licenses.gpl3;
maintainers = with maintainers; [ hexa ];
};
}
13 changes: 13 additions & 0 deletions pkgs/development/python-modules/phonemizer/espeak-path.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/phonemizer/backend/espeak.py b/phonemizer/backend/espeak.py
index 944cc07..d5d252a 100644
--- a/phonemizer/backend/espeak.py
+++ b/phonemizer/backend/espeak.py
@@ -36,7 +36,7 @@ _ESPEAK_FLAGS_RE = re.compile(r'\(.+?\)')
# a global variable being used to overload the default espeak installed on the
# system. The user can choose an alternative espeak with the method
# EspeakBackend.set_espeak_path().
-_ESPEAK_DEFAULT_PATH = None
+_ESPEAK_DEFAULT_PATH = "@espeak@"


class BaseEspeakBackend(BaseBackend):
50 changes: 50 additions & 0 deletions pkgs/development/python-modules/tensorboardx/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{ lib, pkgs
, buildPythonPackage
, fetchFromGitHub
, crc32c
, matplotlib
, numpy
, protobuf
, pytest
, pytorch
, boto3
, moto
, visdom
, wget
}:

buildPythonPackage rec {
pname = "tensorboardX";
version = "2.0";

src = fetchFromGitHub {
owner = "lanpa";
repo = pname;
rev = "v${version}";
sha256 = "0qqalq0fhbx0wnd8wdwhyhkkv2brvj9qbk3373vk3wjxbribf5c7";
};

propagatedBuildInputs = [
crc32c
matplotlib
numpy
protobuf
];

checkInputs = [
pytest
pytorch
boto3
moto
visdom
wget
];

doCheck = false;

meta = {
description = "tensorboard for pytorch (and chainer, mxnet, numpy, ...)";
homepage = "https://tensorboardx.readthedocs.io";
license = lib.licenses.mit;
};
}
24 changes: 24 additions & 0 deletions pkgs/development/python-modules/torchfile/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{ fetchFromGitHub, buildPythonPackage, python3Packages, lib }:

buildPythonPackage rec {
pname = "torchfile";
version = "0.1.0";

src = fetchFromGitHub {
owner = "bshillingford";
repo = "python-${pname}";
rev = version;
sha256 = "0ffajg536jhm772k0kcm3m721rq6j6ldxfjz0hmad0x85dhcr7v2";
};

checkInputs = with python3Packages; [
numpy
];

meta = with lib; {
description = "Deserialize Lua torch-serialized objects from Python";
homepage = "https://github.com/bshillingford/python-torchfile";
license = licenses.bsd3;
maintainers = with maintainers; [ hexa ];
};
}
71 changes: 71 additions & 0 deletions pkgs/development/python-modules/tts/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{ lib
, buildPythonPackage
, fetchFromGitHub
, phonemizer
, tensorboardx
, matplotlib
, scipy
, pytorch
, flask
, attrdict
, bokeh
, soundfile
, tqdm
, librosa
, unidecode
, fetchpatch
}:

buildPythonPackage rec {
pname = "tts";
# until https://github.com/mozilla/TTS/issues/424 is resolved
# we treat released models as released versions:
# https://github.com/mozilla/TTS/wiki/Released-Models
version = "unstable-2020-04-23";

src = fetchFromGitHub {
owner = "mozilla";
repo = "TTS";
rev = "53b24625a7b898447b0cda2929503b96752d9eae";
sha256 = "1mcv3lfpr6dfy57af1ysf6dv6q8l7xq3b6iim10z9rn2zqsklbxf";
};

patches = [
./loosen-deps.patch
# add tts-server executable
# https://github.com/mozilla/TTS/pull/425
(fetchpatch {
url = "https://github.com/mozilla/TTS/commit/edf257a91363c4c58b6e1c9e1a9e7f3b0b37dd17.patch";
sha256 = "087hj13f9kf31i2nvwhkdx37y3qwgdxayzfpv0am5b3f5alsr6xb";
})
];

propagatedBuildInputs = [
matplotlib
scipy
pytorch
flask
attrdict
bokeh
soundfile
tqdm
librosa
unidecode
phonemizer
tensorboardx
];

preBuild = ''
# numba jit tries to write to its cache directory
export HOME=$TMPDIR
'';

doCheck = false;

meta = with lib; {
homepage = "https://github.com/mozilla/TTS";
description = "Deep learning for Text to Speech";
license = licenses.mpl20;
maintainers = with maintainers; [ hexa ];
};
}
26 changes: 26 additions & 0 deletions pkgs/development/python-modules/tts/loosen-deps.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
diff --git a/setup.py b/setup.py
index f92dac8..fa4a11f 100644
--- a/setup.py
+++ b/setup.py
@@ -93,9 +93,9 @@ setup(
install_requires=[
"scipy>=0.19.0",
"torch>=0.4.1",
- "numpy==1.15.4",
- "librosa==0.6.2",
- "unidecode==0.4.20",
+ "numpy>=1.15.4",
+ "librosa>=0.6.2",
+ "unidecode>=0.4.20",
"attrdict",
"tensorboardX",
"matplotlib",
@@ -103,7 +103,7 @@ setup(
"flask",
# "lws",
"tqdm",
- "bokeh==1.4.0",
+ "bokeh>=1.4.0",
"soundfile",
"phonemizer @ https://github.com/bootphon/phonemizer/tarball/master",
],
4 changes: 4 additions & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3169,6 +3169,8 @@ in
inherit (darwin.apple_sdk.frameworks) Security;
};

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

volctl = callPackage ../tools/audio/volctl { };

vorta = python3Packages.callPackage ../applications/backup/vorta { };
Expand Down Expand Up @@ -24236,6 +24238,8 @@ in

tremulous = callPackage ../games/tremulous { };

tts = python3.pkgs.toPythonApplication python3.pkgs.tts;

tuxpaint = callPackage ../games/tuxpaint { };

tuxtype = callPackage ../games/tuxtype { };
Expand Down
8 changes: 8 additions & 0 deletions pkgs/top-level/python-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5024,6 +5024,8 @@ in {

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

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

pgcli = callPackage ../development/tools/database/pgcli {};

pg8000 = callPackage ../development/python-modules/pg8000 { };
Expand Down Expand Up @@ -5992,6 +5994,8 @@ in {

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

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

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

tweepy = callPackage ../development/python-modules/tweepy { };
Expand Down Expand Up @@ -6788,6 +6792,8 @@ in {

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

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

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

jenkinsapi = callPackage ../development/python-modules/jenkinsapi { };
Expand Down Expand Up @@ -6948,6 +6954,8 @@ in {

tensorflow-tensorboard_2 = callPackage ../development/python-modules/tensorflow-tensorboard/2 { };

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

tensorflow-bin = self.tensorflow-bin_1;

tensorflow-bin_1 = callPackage ../development/python-modules/tensorflow/1/bin.nix {
Expand Down