Skip to content

Commit c03660a

Browse files
BordaCopilot
andauthored
bump: bitsandbytes >=0.45.2,<0.47.0 & compatibility patch for bnb.functional.int8_double_quant (#20911)
* compatibility patch for `bnb.functional.int8_double_quant` * bitsandbytes >=0.45.2,<0.47.0 --------- Co-authored-by: Copilot <[email protected]>
1 parent 87e3974 commit c03660a

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

requirements/fabric/strategies.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
# note: is a bug around 0.10 with `MPS_Accelerator must implement all abstract methods`
77
# shall be resolved by https://github.com/microsoft/DeepSpeed/issues/4372
88
deepspeed >=0.8.2, <=0.9.3; platform_system != "Windows" and platform_system != "Darwin" # strict
9-
bitsandbytes >=0.45.2,<0.45.3; platform_system != "Darwin"
9+
bitsandbytes >=0.45.2,<0.47.0; platform_system != "Darwin"

requirements/pytorch/extra.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ hydra-core >=1.2.0, <1.4.0
88
jsonargparse[signatures] >=4.39.0, <4.41.0
99
rich >=12.3.0, <14.1.0
1010
tensorboardX >=2.2, <2.7.0 # min version is set by torch.onnx missing attribute
11-
bitsandbytes >=0.45.2,<0.45.3; platform_system != "Darwin"
11+
bitsandbytes >=0.45.2,<0.47.0; platform_system != "Darwin"

src/lightning/fabric/plugins/precision/bitsandbytes.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,9 +256,10 @@ def quantize(
256256
if int8params.has_fp16_weights:
257257
int8params.data = B
258258
else:
259-
CB, CBt, SCB, SCBt, _ = bnb.functional.double_quant(B)
260-
del CBt
261-
del SCBt
259+
if hasattr(bnb.functional, "double_quant"):
260+
CB, _, SCB, _, _ = bnb.functional.double_quant(B)
261+
else: # for bitsandbytes versions ≥0.46
262+
CB, SCB = bnb.functional.int8_double_quant(B)
262263
int8params.data = CB
263264
setattr(int8params, "CB", CB)
264265
setattr(int8params, "SCB", SCB)

0 commit comments

Comments
 (0)