diff --git a/pkgs/development/python-modules/clean-fid/default.nix b/pkgs/development/python-modules/clean-fid/default.nix new file mode 100644 index 000000000000..7a2f328185e4 --- /dev/null +++ b/pkgs/development/python-modules/clean-fid/default.nix @@ -0,0 +1,50 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub + +# dependencies +, numpy +, pillow +, requests +, scipy +, torch +, torchvision +, tqdm +}: + +buildPythonPackage rec { + pname = "clean-fid"; + version = "0.1.35"; + format = "setuptools"; + + src = fetchFromGitHub { + owner = "GaParmar"; + repo = "clean-fid"; + rev = "c8ffa420a3923e8fd87c1e75170de2cf59d2644b"; + hash = "sha256-fqBU/TmCXDTPU3KTP0+VYQoP+HsT2UMcZeLzQHKD9hw="; + }; + + propagatedBuildInputs = [ + numpy + pillow + requests + scipy + torch + torchvision + tqdm + ]; + + pythonImportsCheck = [ + "cleanfid" + ]; + + # no tests1 + doCheck = false; + + meta = with lib; { + description = "PyTorch - FID calculation with proper image resizing and quantization steps [CVPR 2022]"; + homepage = "https://github.com/GaParmar/clean-fid"; + license = licenses.mit; + maintainers = teams.tts.members; + }; +} diff --git a/pkgs/development/python-modules/clip-anytorch/default.nix b/pkgs/development/python-modules/clip-anytorch/default.nix new file mode 100644 index 000000000000..b689d5708d5f --- /dev/null +++ b/pkgs/development/python-modules/clip-anytorch/default.nix @@ -0,0 +1,57 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub + +# dependencies +, ftfy +, regex +, tqdm +, torch +, torchvision + +# tests +, pytestCheckHook +}: + +buildPythonPackage rec { + pname = "clip-anytorch"; + version = "2.5.2"; + format = "setuptools"; + + src = fetchFromGitHub { + owner = "rom1504"; + repo = "CLIP"; + rev = version; + hash = "sha256-EqVkpMQHawoCFHNupf49NrvLdGCq35wnYBpdP81Ztd4="; + }; + + propagatedBuildInputs = [ + ftfy + regex + tqdm + torch + torchvision + ]; + + pythonImportsCheck = [ + "clip" + ]; + + # all tests require network access + doCheck = false; + + nativeCheckInputs = [ + pytestCheckHook + ]; + + preCheck = '' + export HOME=$TMPDIR + ''; + + meta = with lib; { + description = "Contrastive Language-Image Pretraining"; + homepage = "https://github.com/rom1504/CLIP"; + license = licenses.mit; + maintainers = teams.tts.members; + }; +} diff --git a/pkgs/development/python-modules/k-diffusion/default.nix b/pkgs/development/python-modules/k-diffusion/default.nix new file mode 100644 index 000000000000..0d1410a5ced0 --- /dev/null +++ b/pkgs/development/python-modules/k-diffusion/default.nix @@ -0,0 +1,69 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub + +# dependencies +, accelerate +, clean-fid +, clip-anytorch +, einops +, jsonmerge +, kornia +, pillow +, resize-right +, scikit-image +, scipy +, torch +, torchdiffeq +, torchsde +, torchvision +, tqdm +, wandb + +}: + +buildPythonPackage rec { + pname = "k-diffusion"; + version = "0.0.14"; + format = "setuptools"; + + src = fetchFromGitHub { + owner = "crowsonkb"; + repo = "k-diffusion"; + rev = "v${version}"; + hash = "sha256-KKVgk+1hidDBVaRnXjoqwuSRydI10OPHK3YModAizZU="; + }; + + propagatedBuildInputs = [ + accelerate + clean-fid + clip-anytorch + einops + jsonmerge + kornia + pillow + resize-right + scikit-image + scipy + torch + torchdiffeq + torchsde + torchvision + tqdm + wandb + ]; + + pythonImportsCheck = [ + "k_diffusion" + ]; + + # no tests + doCheck = false; + + meta = with lib; { + description = "Karras et al. (2022) diffusion models for PyTorch"; + homepage = "https://github.com/crowsonkb/k-diffusion"; + license = licenses.mit; + maintainers = teams.tts.members; + }; +} diff --git a/pkgs/development/python-modules/resize-right/default.nix b/pkgs/development/python-modules/resize-right/default.nix new file mode 100644 index 000000000000..6a0b9b5cd773 --- /dev/null +++ b/pkgs/development/python-modules/resize-right/default.nix @@ -0,0 +1,37 @@ +{ lib +, buildPythonPackage +, fetchPypi + +# dependencies +, numpy +, torch +}: + +buildPythonPackage rec { + pname = "resize-right"; + version = "0.0.2"; + + src = fetchPypi { + inherit pname version; + hash = "sha256-fcNbcs5AErd/fMkEmDUWN5OrmKWKuIk2EPsRn+Wa9SA="; + }; + + propagatedBuildInputs = [ + numpy + torch + ]; + + pythonImportsCheck = [ + "resize_right" + ]; + + # no tests + doCheck = false; + + meta = with lib; { + description = "The correct way to resize images or tensors. For Numpy or Pytorch (differentiable"; + homepage = "https://github.com/assafshocher/ResizeRight"; + license = licenses.mit; + maintainers = teams.tts.members; + }; +} diff --git a/pkgs/development/python-modules/torchdiffeq/default.nix b/pkgs/development/python-modules/torchdiffeq/default.nix new file mode 100644 index 000000000000..8195d750c6f7 --- /dev/null +++ b/pkgs/development/python-modules/torchdiffeq/default.nix @@ -0,0 +1,43 @@ +{ lib +, buildPythonPackage +, fetchPypi + +# dependencies +, torch +, scipy + +# tests +, pytestCheckHook +}: + +buildPythonPackage rec { + pname = "torchdiffeq"; + version = "0.2.3"; + format = "setuptools"; + + src = fetchPypi { + inherit pname version; + hash = "sha256-/nX0NLkJCsDCdwLgK+0hRysPhwNb5lgfUe3F1AE+oxo="; + }; + + propagatedBuildInputs = [ + torch + scipy + ]; + + pythonImportsCheck = [ "torchdiffeq" ]; + + # no tests in sdist, no tags on git + doCheck = false; + + nativeCheckInputs = [ + pytestCheckHook + ]; + + meta = with lib; { + description = "Differentiable ODE solvers with full GPU support and O(1)-memory backpropagation"; + homepage = "https://github.com/rtqichen/torchdiffeq"; + license = licenses.mit; + maintainers = teams.tts.members; + }; +} diff --git a/pkgs/development/python-modules/torchsde/default.nix b/pkgs/development/python-modules/torchsde/default.nix new file mode 100644 index 000000000000..30e5a1235ddd --- /dev/null +++ b/pkgs/development/python-modules/torchsde/default.nix @@ -0,0 +1,67 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub + +# build-system +, setuptools + +# dependencies +, boltons +, numpy +, scipy +, torch +, trampoline + +# tests +, pytestCheckHook +}: + +buildPythonPackage rec { + pname = "torchsde"; + version = "0.2.4"; + format = "pyproject"; + + src = fetchFromGitHub { + owner = "google-research"; + repo = "torchsde"; + rev = "v${version}"; + hash = "sha256-qQ7oswm0qTdq1xpQElt5cd3K0zskH+H/lgyEnxbCqsI="; + }; + + postPatch = '' + substituteInPlace setup.py \ + --replace "numpy==1.19.*" "numpy" \ + --replace "scipy==1.5.*" "scipy" + ''; + + nativeBuildInputs = [ + setuptools + ]; + + propagatedBuildInputs = [ + boltons + numpy + scipy + torch + trampoline + ]; + + pythonImportsCheck = [ "torchsde" ]; + + nativeCheckInputs = [ + pytestCheckHook + ]; + + disabledTests = [ + # RuntimeError: a view of a leaf Variable that requires grad is being used in an in-place operation. + "test_adjoint" + ]; + + meta = with lib; { + changelog = "https://github.com/google-research/torchsde/releases/tag/v${version}"; + description = "Differentiable SDE solvers with GPU support and efficient sensitivity analysis"; + homepage = "https://github.com/google-research/torchsde"; + license = licenses.asl20; + maintainers = teams.tts.members; + }; +} diff --git a/pkgs/development/python-modules/trampoline/default.nix b/pkgs/development/python-modules/trampoline/default.nix new file mode 100644 index 000000000000..2be2ff6e819d --- /dev/null +++ b/pkgs/development/python-modules/trampoline/default.nix @@ -0,0 +1,34 @@ +{ lib +, buildPythonPackage +, fetchFromGitLab +, pytestCheckHook +}: + +buildPythonPackage { + pname = "trampoline"; + version = "0.1.2"; + format = "setuptools"; + + # only wheel on pypi, no tags on git + src = fetchFromGitLab { + owner = "ferreum"; + repo = "trampoline"; + rev = "1d98f39c3015594e2ac8ed48dccc2f393b4dd82b"; + hash = "sha256-A/tuR+QW9sKh76Qjwn1uQxlVJgWrSFzXeBRDdnSi2o4="; + }; + + pythonImportsCheck = [ + "trampoline" + ]; + + nativeCheckInputs = [ + pytestCheckHook + ]; + + meta = with lib; { + description = "Simple and tiny yield-based trampoline implementation for python"; + homepage = "https://gitlab.com/ferreum/trampoline"; + license = licenses.mit; + maintainers = teams.tts.members; + }; +} diff --git a/pkgs/tools/audio/tts/default.nix b/pkgs/tools/audio/tts/default.nix index 24dbfee17517..e0eecc958a8f 100644 --- a/pkgs/tools/audio/tts/default.nix +++ b/pkgs/tools/audio/tts/default.nix @@ -8,19 +8,21 @@ let python = python3.override { packageOverrides = self: super: { + torch = super.torch-bin; + torchvision = super.torchvision-bin; }; }; in python.pkgs.buildPythonApplication rec { pname = "tts"; - version = "0.13.3"; + version = "0.14.0"; format = "pyproject"; src = fetchFromGitHub { owner = "coqui-ai"; repo = "TTS"; rev = "refs/tags/v${version}"; - hash = "sha256-cu714/XtVqqlHN2CmUObcNFG6Vdi9VqC4at/HB8euDs="; + hash = "sha256-AVU4ULz++t9850pYeNrG5HKNvUZcMld4O1/zu697rzk="; }; postPatch = let @@ -57,6 +59,7 @@ python.pkgs.buildPythonApplication rec { bnnumerizer bnunicodenormalizer coqpit + einops flask fsspec g2pkk @@ -65,6 +68,7 @@ python.pkgs.buildPythonApplication rec { inflect jamo jieba + k-diffusion librosa matplotlib mecab-python3 @@ -81,6 +85,7 @@ python.pkgs.buildPythonApplication rec { torchaudio-bin tqdm trainer + transformers unidic-lite webrtcvad ]; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 0d276e25ce8f..f9f27fd4b2a5 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -1831,6 +1831,8 @@ self: super: with self; { cle = callPackage ../development/python-modules/cle { }; + clean-fid = callPackage ../development/python-modules/clean-fid { }; + cleo = callPackage ../development/python-modules/cleo { }; clevercsv = callPackage ../development/python-modules/clevercsv { }; @@ -1839,6 +1841,8 @@ self: super: with self; { clip = callPackage ../development/python-modules/clip { }; + clip-anytorch = callPackage ../development/python-modules/clip-anytorch { }; + cock = callPackage ../development/python-modules/cock { }; click = callPackage ../development/python-modules/click { }; @@ -5320,6 +5324,8 @@ self: super: with self; { jxmlease = callPackage ../development/python-modules/jxmlease { }; + k-diffusion = callPackage ../development/python-modules/k-diffusion { }; + k5test = callPackage ../development/python-modules/k5test { inherit (pkgs) krb5 findutils; }; @@ -10463,6 +10469,8 @@ self: super: with self; { resampy = callPackage ../development/python-modules/resampy { }; + resize-right = callPackage ../development/python-modules/resize-right { }; + resolvelib = callPackage ../development/python-modules/resolvelib { }; responses = callPackage ../development/python-modules/responses { }; @@ -12147,6 +12155,8 @@ self: super: with self; { torchaudio-bin = callPackage ../development/python-modules/torchaudio/bin.nix { }; + torchdiffeq = callPackage ../development/python-modules/torchdiffeq { }; + torchgpipe = callPackage ../development/python-modules/torchgpipe { }; torchmetrics = callPackage ../development/python-modules/torchmetrics { }; @@ -12157,6 +12167,8 @@ self: super: with self; { torchlibrosa = callPackage ../development/python-modules/torchlibrosa { }; + torchsde = callPackage ../development/python-modules/torchsde { }; + torchvision = callPackage ../development/python-modules/torchvision { }; torchvision-bin = callPackage ../development/python-modules/torchvision/bin.nix { }; @@ -12203,6 +12215,8 @@ self: super: with self; { traittypes = callPackage ../development/python-modules/traittypes { }; + trampoline = callPackage ../development/python-modules/trampoline { }; + transaction = callPackage ../development/python-modules/transaction { }; transformers = callPackage ../development/python-modules/transformers { };