From b91c063cdfdf4758cdf51866d866412fa6d7ffbe Mon Sep 17 00:00:00 2001 From: Aaron Meese Date: Mon, 16 Mar 2026 16:26:03 -0400 Subject: [PATCH] fix: accept **kwargs in Params4bit and Int8Params constructors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit accelerate's set_module_tensor_to_device passes the old parameter's __dict__ as **kwargs when reconstituting quantized parameters. Transformers >= 5.x adds _is_hf_initialized to every parameter's __dict__, but Params4bit.__new__ and Int8Params.__new__ had fixed signatures — causing TypeError on any model loaded with BitsAndBytesConfig + device_map="auto". Add **kwargs to both constructors so unexpected attributes are silently ignored instead of crashing. --- bitsandbytes/nn/modules.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bitsandbytes/nn/modules.py b/bitsandbytes/nn/modules.py index ff8ce9c3d..54506f41d 100644 --- a/bitsandbytes/nn/modules.py +++ b/bitsandbytes/nn/modules.py @@ -222,6 +222,7 @@ def __new__( quant_storage: torch.dtype = torch.uint8, module: Optional["Linear4bit"] = None, bnb_quantized: bool = False, + **kwargs, ) -> "Params4bit": if data is None: data = torch.empty(0) @@ -680,6 +681,7 @@ def __new__( has_fp16_weights=False, CB: Optional[torch.Tensor] = None, SCB: Optional[torch.Tensor] = None, + **kwargs, ): if data is None: data = torch.empty(0)