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