commit 54b95c659a6465d9b36ce4ace545f949bce2bb9c Author: Tobias Manherz Date: Wed Nov 15 22:55:29 2023 +0100 first commit diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..30416bf --- /dev/null +++ b/default.nix @@ -0,0 +1,43 @@ +with import +{ + config = { allowUnfree = true; cudaSupport = true; }; + overlays = [ + ( + final: prev: { + final.python310 = prev.python310.override { + enableOptimizations = true; + reproducibleBuild = false; + self = final.python310; + buildInputs = [ final.ffmpeg-full ]; + }; + pythonPackagesExtensions = prev.pythonPackagesExtensions ++ [ + ( + python-final: python-prev: { + pytorch-seed = python-final.callPackage ./pythonPackages/pytorch-seed { }; + audiolm-pytorch = python-final.callPackage ./pythonPackages/audiolm-pytorch { }; + vector-quantize-pytorch = python-final.callPackage ./pythonPackages/vector-quantize-pytorch { }; + local-attention = python-final.callPackage ./pythonPackages/local-attention { }; + ema-pytorch = python-final.callPackage ./pythonPackages/ema-pytorch { }; + + openai-triton = python-prev.openai-triton-bin; + torch = python-prev.torch-bin; + torchaudio = python-prev.torchaudio-bin; + + bark-gui = python-final.callPackage ./pythonPackages/bark-gui.nix { }; + } + ) + ]; + } + ) + ]; +}; + +pkgs.mkShell rec { + name = "barkTestEnv"; + buildInputs = [ + (pkgs.python310.withPackages (ps: with ps; [ bark-gui ])) + ]; + shellHook = '' + echo ${python310Packages.bark-gui} + ''; +} diff --git a/pythonPackages/audiolm-pytorch/default.nix b/pythonPackages/audiolm-pytorch/default.nix new file mode 100644 index 0000000..2aa3418 --- /dev/null +++ b/pythonPackages/audiolm-pytorch/default.nix @@ -0,0 +1,55 @@ +{ lib +, buildPythonPackage +, fetchPypi +, setuptools +, packaging +, torch +, einops +, beartype +, torchaudio +, fairseq +, transformers +, vector-quantize-pytorch +, local-attention +, encodec +, lion-pytorch +, ema-pytorch +, accelerate +}: + +buildPythonPackage rec { + pname = "audiolm-pytorch"; + version = "1.7.6"; + format = "pyproject"; + + src = fetchPypi { + inherit pname version; + hash = "sha256-Roo17hhrlNqnAt43kKQRnkHn6fvtW+vEVxLVHK0k884="; + }; + + buildInputs = [ + setuptools + ]; + propagatedBuildInputs = [ + packaging + torch + einops + beartype + torchaudio + fairseq + transformers + vector-quantize-pytorch + local-attention + encodec + lion-pytorch + ema-pytorch + accelerate + ]; + + pythonImportsCheck = [ "audiolm_pytorch" ]; + + meta = with lib; { + license = licenses.mit; + maintainers = with maintainers; [ ]; + }; +} diff --git a/pythonPackages/bark-gui.nix b/pythonPackages/bark-gui.nix new file mode 100644 index 0000000..198ed13 --- /dev/null +++ b/pythonPackages/bark-gui.nix @@ -0,0 +1,83 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub +, writeShellScript +, setuptools + + # dependencies +, fairseq +, audiolm-pytorch +, gradio +, funcy +, linkify-it-py +, mutagen +, pytorch-seed +, pyyaml +, sentencepiece +, transformers + +, ffmpeg-full +}: + +buildPythonPackage rec { + pname = "bark-gui"; + format = "pyproject"; + version = "0.7.1"; + + src = fetchFromGitHub { + owner = "C0untFloyd"; + repo = "${pname}"; + rev = "v07.1"; + sha256 = "sha256-3UvX8c8SSzfeTleGU2FoAhmSj+EG0RPMtqozaopt9Fk="; + }; + + propagatedBuildInputs = [ + fairseq + audiolm-pytorch + gradio + funcy + linkify-it-py + mutagen + pytorch-seed + pyyaml + sentencepiece + transformers + ]; + buildInputs = [ + setuptools + ffmpeg-full + ]; + + dontWrapPythonPrograms = true; + postFixup = + let + setupScript = writeShellScript "bark-gui" '' + if [[ ! -d $HOME/.bark-gui ]]; then + mkdir -p $HOME + cp -r ${src} $HOME/.bark-gui + chmod 0755 $HOME/.bark-gui + chmod 0644 $HOME/.bark-gui/config.yaml + mkdir -p $HOME/.bark-gui/training/data/output + mkdir -p $HOME/.bark-gui/training/inputtext + chmod 755 $HOME/.bark-gui/training/data/output $HOME/.bark-gui/training/inputtext $HOME/.bark-gui/bark/assets/prompts/custom/ + fi + pushd "$PWD" + cd $HOME/.bark-gui/ + MYOLDPATH="$PATH" + export PATH="$PATH:${ffmpeg-full.bin}/bin/" + python webui.py "$@" + export PATH="$MYOLDPATH" + popd + ''; + in + '' + mkdir -p $out/bin + ln -s ${setupScript} $out/bin/bark-gui + ''; + + meta = with lib; { + maintainers = [ ]; + platforms = platforms.all; + }; +} + diff --git a/pythonPackages/ema-pytorch/default.nix b/pythonPackages/ema-pytorch/default.nix new file mode 100644 index 0000000..b5fe51f --- /dev/null +++ b/pythonPackages/ema-pytorch/default.nix @@ -0,0 +1,33 @@ +{ lib +, buildPythonPackage +, fetchPypi +, setuptools +, torch +, beartype +}: + +buildPythonPackage rec { + pname = "ema-pytorch"; + version = "0.3.0"; + format = "pyproject"; + + src = fetchPypi { + inherit pname version; + hash = "sha256-xZv/45dxN2aYUUAq9JRlCWcJnalAD1SuMbyU+//jBhw="; + }; + + buildInputs = [ + setuptools + ]; + propagatedBuildInputs = [ + torch + beartype + ]; + + pythonImportsCheck = [ "ema_pytorch" ]; + + meta = with lib; { + license = licenses.mit; + maintainers = with maintainers; [ ]; + }; +} \ No newline at end of file diff --git a/pythonPackages/local-attention/default.nix b/pythonPackages/local-attention/default.nix new file mode 100644 index 0000000..8bc861e --- /dev/null +++ b/pythonPackages/local-attention/default.nix @@ -0,0 +1,33 @@ +{ lib +, buildPythonPackage +, fetchPypi +, setuptools +, torch +, einops +}: + +buildPythonPackage rec { + pname = "local-attention"; + version = "1.9.0"; + format = "pyproject"; + + src = fetchPypi { + inherit pname version; + hash = "sha256-p7F53JIjWLS7SLMXLPs0nttFnRvc5YnYN4alel42kKY="; + }; + + buildInputs = [ + setuptools + ]; + propagatedBuildInputs = [ + torch + einops + ]; + + pythonImportsCheck = [ "local_attention" ]; + + meta = with lib; { + license = licenses.mit; + maintainers = with maintainers; [ ]; + }; +} \ No newline at end of file diff --git a/pythonPackages/pytorch-seed/default.nix b/pythonPackages/pytorch-seed/default.nix new file mode 100644 index 0000000..cb8d566 --- /dev/null +++ b/pythonPackages/pytorch-seed/default.nix @@ -0,0 +1,33 @@ +{ lib +, buildPythonPackage +, fetchPypi +, setuptools +, torch +, numpy +}: + +buildPythonPackage rec { + pname = "pytorch_seed"; + version = "0.2.0"; + format = "pyproject"; + + src = fetchPypi { + inherit pname version; + hash = "sha256-CW7dNAT4oA898rq0ECSUWAa68fZLBWeMgjc7eARY4aM="; + }; + + buildInputs = [ + setuptools + ]; + propagatedBuildInputs = [ + torch + numpy + ]; + + pythonImportsCheck = [ "pytorch_seed" ]; + + meta = with lib; { + license = licenses.mit; + maintainers = with maintainers; [ ]; + }; +} \ No newline at end of file diff --git a/pythonPackages/vector-quantize-pytorch/default.nix b/pythonPackages/vector-quantize-pytorch/default.nix new file mode 100644 index 0000000..438668c --- /dev/null +++ b/pythonPackages/vector-quantize-pytorch/default.nix @@ -0,0 +1,33 @@ +{ lib +, buildPythonPackage +, fetchPypi +, setuptools +, torch +, einops +}: + +buildPythonPackage rec { + pname = "vector_quantize_pytorch"; + version = "1.11.7"; + format = "pyproject"; + + src = fetchPypi { + inherit pname version; + hash = "sha256-kMKeWhnTXbI+ROPJ0LHVh7TQjonhRzXUQm+U8TgghSM="; + }; + + buildInputs = [ + setuptools + ]; + propagatedBuildInputs = [ + torch + einops + ]; + + pythonImportsCheck = [ "vector_quantize_pytorch" ]; + + meta = with lib; { + license = licenses.mit; + maintainers = with maintainers; [ ]; + }; +} \ No newline at end of file