Unverified Commit a52cccf7 authored by Franz Pletz's avatar Franz Pletz Committed by GitHub
Browse files

Merge pull request #248176 from bcdarwin/update-bitsandbytes

python310Packages.bitsandbytes: 0.38.0 -> 0.41.0
parents 6574d902 b2ac1c2b
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -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"