Skip to content

Commit 4a61395

Browse files
committed
compatibility patch for bnb.functional.int8_double_quant
1 parent 87e3974 commit 4a61395

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

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 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)