depot/third_party/nixpkgs/pkgs/development/python-modules/openai-whisper/default.nix
Default email 5083ee08a2 Project import generated by Copybara.
GitOrigin-RevId: 10ecda252ce1b3b1d6403caeadbcc8f30d5ab796
2022-09-30 06:47:45 -05:00

64 lines
1.1 KiB
Nix

{ lib
, fetchFromGitHub
, buildPythonPackage
# propagates
, numpy
, torch
, tqdm
, more-itertools
, transformers
, ffmpeg-python
# tests
, pytestCheckHook
}:
buildPythonPackage rec {
pname = "whisper";
version = "unstable-2022-09-23";
format = "setuptools";
src = fetchFromGitHub {
owner = "openai";
repo = pname;
rev = "8cf36f3508c9acd341a45eb2364239a3d81458b9";
hash = "sha256-2RH8eM/SezqFJltelv5AjQEGpqXm980u57vrlkTEUvQ=";
};
postPatch = ''
# Rely on the ffmpeg path already patched into the ffmpeg-python library
substituteInPlace whisper/audio.py \
--replace 'run(cmd="ffmpeg",' 'run('
'';
propagatedBuildInputs = [
numpy
torch
tqdm
more-itertools
transformers
ffmpeg-python
];
preCheck = ''
export HOME=$TMPDIR
'';
checkInputs = [
pytestCheckHook
];
disabledTests = [
# requires network access to download models
"test_transcribe"
];
meta = with lib; {
description = "General-purpose speech recognition model";
homepage = "https://github.com/openai/whisper";
license = licenses.mit;
maintainers = with maintainers; [ hexa ];
};
}