summary refs log tree commit diff
path: root/pkgs/tools/audio/piper/train.nix
blob: a385ebb85ad6698a09124edf08bec335ed6979d5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
{ piper-tts
, python3
}:

let
  python = python3.override {
    packageOverrides = self: super: {
    };
  };
in

python.pkgs.buildPythonPackage {
  inherit (piper-tts) version src;

  pname = "piper-train";
  format = "setuptools";

  sourceRoot = "source/src/python";

  nativeBuildInputs = with python.pkgs; [
    cython
  ];

  postBuild = ''
    make -C piper_train/vits/monotonic_align
  '';

  postInstall = ''
    export MONOTONIC_ALIGN=$out/${python.sitePackages}/piper_train/vits/monotonic_align/monotonic_align
    mkdir -p $MONOTONIC_ALIGN
    cp -v ./piper_train/vits/monotonic_align/piper_train/vits/monotonic_align/core.*.so $MONOTONIC_ALIGN/
  '';

  propagatedBuildInputs = with python.pkgs; [
    espeak-phonemizer
    librosa
    numpy
    onnxruntime
    piper-phonemize
    pytorch-lightning
    torch
  ];

  pythonImportsCheck = [
    "piper_train"
  ];

  doCheck = false; # no tests

  meta = piper-tts.meta // {
    # requires torch<2, pytorch-lightning~=1.7
    broken = true;
  };
}