python310Packages.bitsandbytes: 0.38.0 -> 0.41.0

This commit is contained in:
Ben Darwin 2023-08-09 09:43:09 -04:00
parent 0e28518bed
commit b2ac1c2b81

View file

@ -5,6 +5,7 @@
, pythonOlder , pythonOlder
, pytestCheckHook , pytestCheckHook
, setuptools , setuptools
, wheel
, torch , torch
, einops , einops
, lion-pytorch , lion-pytorch
@ -14,7 +15,7 @@
let let
pname = "bitsandbytes"; pname = "bitsandbytes";
version = "0.38.0"; version = "0.41.0";
inherit (torch) cudaCapabilities cudaPackages cudaSupport; inherit (torch) cudaCapabilities cudaPackages cudaSupport;
inherit (cudaPackages) backendStdenv cudaVersion; inherit (cudaPackages) backendStdenv cudaVersion;
@ -53,14 +54,14 @@ buildPythonPackage {
owner = "TimDettmers"; owner = "TimDettmers";
repo = pname; repo = pname;
rev = "refs/tags/${version}"; rev = "refs/tags/${version}";
hash = "sha256-gGlbzTDvZNo4MhcYzLvWuB2ec7q+Qt5/LtTbJ0Rc+Kk="; hash = "sha256-e6SK2ylITookO6bhpfdRp/V4y2S9rk6Lo1PD3xXrcmM=";
}; };
postPatch = '' postPatch = ''
substituteInPlace Makefile --replace "/usr/bin/g++" "g++" --replace "lib64" "lib" substituteInPlace Makefile --replace "/usr/bin/g++" "g++" --replace "lib64" "lib"
substituteInPlace bitsandbytes/cuda_setup/main.py \ substituteInPlace bitsandbytes/cuda_setup/main.py \
--replace "binary_path = package_dir / binary_name" \ --replace "binary_path = package_dir / self.binary_name" \
"binary_path = Path('$out/${python.sitePackages}/${pname}')/binary_name" "binary_path = Path('$out/${python.sitePackages}/${pname}')/self.binary_name"
'' + lib.optionalString torch.cudaSupport '' '' + lib.optionalString torch.cudaSupport ''
substituteInPlace bitsandbytes/cuda_setup/main.py \ substituteInPlace bitsandbytes/cuda_setup/main.py \
--replace "/usr/local/cuda/lib64" "${cuda-native-redist}/lib" --replace "/usr/local/cuda/lib64" "${cuda-native-redist}/lib"
@ -75,15 +76,16 @@ buildPythonPackage {
else else
''make CUDA_VERSION=CPU cpuonly''; ''make CUDA_VERSION=CPU cpuonly'';
nativeBuildInputs = [ setuptools ] ++ lib.optionals torch.cudaSupport [ cuda-native-redist ]; nativeBuildInputs = [ setuptools wheel ] ++ lib.optionals torch.cudaSupport [ cuda-native-redist ];
buildInputs = lib.optionals torch.cudaSupport [ cuda-redist ]; buildInputs = lib.optionals torch.cudaSupport [ cuda-redist ];
propagatedBuildInputs = [ propagatedBuildInputs = [
scipy
torch torch
]; ];
doCheck = false; # tests require CUDA and also GPU access doCheck = false; # tests require CUDA and also GPU access
nativeCheckInputs = [ pytestCheckHook einops lion-pytorch scipy ]; nativeCheckInputs = [ pytestCheckHook einops lion-pytorch ];
pythonImportsCheck = [ pythonImportsCheck = [
"bitsandbytes" "bitsandbytes"