openai-whisper-cpp: fix darwin build & add file for metal

Co-Authored-By: Hugh O'Brien <github@hughobrien.ie>
This commit is contained in:
David Knaack
2024-01-05 09:57:53 +01:00
co-authored by Hugh O'Brien
parent ccd85f7b9c
commit 4b4f0f8034
2 changed files with 12 additions and 2 deletions
@@ -8,6 +8,7 @@
, CoreGraphics
, CoreML
, CoreVideo
, MetalKit
}:
stdenv.mkDerivation rec {
@@ -29,7 +30,7 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ makeWrapper ];
buildInputs = [ SDL2 ] ++ lib.optionals stdenv.isDarwin [ Accelerate CoreGraphics CoreML CoreVideo ];
buildInputs = [ SDL2 ] ++ lib.optionals stdenv.isDarwin [ Accelerate CoreGraphics CoreML CoreVideo MetalKit ];
env = lib.optionalAttrs stdenv.isDarwin {
WHISPER_COREML = "1";
@@ -51,6 +52,15 @@ stdenv.mkDerivation rec {
wrapProgram $out/bin/whisper-cpp-download-ggml-model \
--prefix PATH : ${lib.makeBinPath [wget]}
${lib.optionalString stdenv.isDarwin ''
install -Dt $out/share/whisper-cpp ggml-metal.metal
for bin in whisper-cpp whisper-cpp-stream whisper-cpp-command; do
wrapProgram $out/bin/$bin \
--set-default GGML_METAL_PATH_RESOURCES $out/share/whisper-cpp
done
''}
runHook postInstall
'';
+1 -1
View File
@@ -19716,7 +19716,7 @@ with pkgs;
openai-whisper = with python3.pkgs; toPythonApplication openai-whisper;
openai-whisper-cpp = darwin.apple_sdk_11_0.callPackage ../tools/audio/openai-whisper-cpp {
inherit (darwin.apple_sdk_11_0.frameworks) Accelerate CoreGraphics CoreML CoreVideo;
inherit (darwin.apple_sdk_11_0.frameworks) Accelerate CoreGraphics CoreML CoreVideo MetalKit;
};
opengrok = callPackage ../development/tools/misc/opengrok { };