summary refs log tree commit diff
diff options
context:
space:
mode:
authorMartin Weinelt <mweinelt@users.noreply.github.com>2023-11-18 23:54:42 +0100
committerGitHub <noreply@github.com>2023-11-18 23:54:42 +0100
commite7e5233f7f6e7264951414f32c0f5f1a7241b29b (patch)
tree418ded4bd7bc4ef10de0ce121f9fa8711da66b0e
parent8314afe1725e064a483e0e7d96b657c89a6c67f0 (diff)
parent0aeec365caf1496ecdb86b63e916d7d508e3431e (diff)
downloadnixpkgs-e7e5233f7f6e7264951414f32c0f5f1a7241b29b.tar
nixpkgs-e7e5233f7f6e7264951414f32c0f5f1a7241b29b.tar.gz
nixpkgs-e7e5233f7f6e7264951414f32c0f5f1a7241b29b.tar.bz2
nixpkgs-e7e5233f7f6e7264951414f32c0f5f1a7241b29b.tar.lz
nixpkgs-e7e5233f7f6e7264951414f32c0f5f1a7241b29b.tar.xz
nixpkgs-e7e5233f7f6e7264951414f32c0f5f1a7241b29b.tar.zst
nixpkgs-e7e5233f7f6e7264951414f32c0f5f1a7241b29b.zip
Merge pull request #268177 from mweinelt/openai-whisper-20231117
openai-whisper: 20230918 -> 20231117
-rw-r--r--pkgs/development/python-modules/openai-whisper/default.nix47
-rw-r--r--pkgs/top-level/python-packages.nix5
2 files changed, 20 insertions, 32 deletions
diff --git a/pkgs/development/python-modules/openai-whisper/default.nix b/pkgs/development/python-modules/openai-whisper/default.nix
index 68f692e4c37..7983abd2e98 100644
--- a/pkgs/development/python-modules/openai-whisper/default.nix
+++ b/pkgs/development/python-modules/openai-whisper/default.nix
@@ -2,22 +2,23 @@
 , fetchFromGitHub
 , buildPythonPackage
 , substituteAll
-, cudaSupport ? false
+
+# build-system
+, setuptools
 
 # runtime
 , ffmpeg-headless
 
 # propagates
-, numpy
-, torch
-, torchWithCuda
-, tqdm
 , more-itertools
-, transformers
 , numba
+, numpy
 , openai-triton
 , scipy
 , tiktoken
+, torch
+, tqdm
+, transformers
 
 # tests
 , pytestCheckHook
@@ -25,14 +26,14 @@
 
 buildPythonPackage rec {
   pname = "whisper";
-  version = "20230918";
-  format = "setuptools";
+  version = "20231117";
+  pyproject = true;
 
   src = fetchFromGitHub {
     owner = "openai";
     repo = pname;
     rev = "refs/tags/v${version}";
-    hash = "sha256-wBAanFVEIIzTcoX40P9eI26UdEu0SC/xuife/zi2Xho=";
+    hash = "sha256-MJ1XjB/GuYUiECCuuHS0NWHvvs+ko0oTvLuDI7zLNiY=";
   };
 
   patches = [
@@ -42,32 +43,22 @@ buildPythonPackage rec {
     })
   ];
 
+  nativeBuildInputs = [
+    setuptools
+  ];
+
   propagatedBuildInputs = [
-    numpy
-    tqdm
     more-itertools
-    transformers
     numba
+    numpy
+    openai-triton
     scipy
     tiktoken
-  ] ++ lib.optionals (!cudaSupport) [
     torch
-  ] ++ lib.optionals (cudaSupport) [
-    openai-triton
-    torchWithCuda
+    tqdm
+    transformers
   ];
 
-  postPatch = ''
-    substituteInPlace requirements.txt \
-      --replace "tiktoken==0.3.3" "tiktoken>=0.3.3"
-  ''
-  # openai-triton is only needed for CUDA support.
-  # triton needs CUDA to be build.
-  # -> by making it optional, we can build whisper without unfree packages enabled
-  + lib.optionalString (!cudaSupport) ''
-    sed -i '/if sys.platform.startswith("linux") and platform.machine() == "x86_64":/{N;d}' setup.py
-  '';
-
   preCheck = ''
     export HOME=$TMPDIR
   '';
@@ -85,7 +76,7 @@ buildPythonPackage rec {
   ];
 
   meta = with lib; {
-    changelog = "https://github.com/openai/whisper/blob/v$[version}/CHANGELOG.md";
+    changelog = "https://github.com/openai/whisper/blob/v${version}/CHANGELOG.md";
     description = "General-purpose speech recognition model";
     homepage = "https://github.com/openai/whisper";
     license = licenses.mit;
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index 2aae4c23d62..13bd7d07d53 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -8470,10 +8470,7 @@ self: super: with self; {
 
   openai-triton-bin = callPackage ../development/python-modules/openai-triton/bin.nix { };
 
-  openai-whisper = callPackage ../development/python-modules/openai-whisper {
-    inherit (pkgs.config) cudaSupport;
-    openai-triton = self.openai-triton-cuda;
-  };
+  openai-whisper = callPackage ../development/python-modules/openai-whisper { };
 
   openant = callPackage ../development/python-modules/openant { };