Skip to content

Commit

Permalink
Merge pull request #1295 from matthewdouglas/fsdp-load-prequantized
Browse files Browse the repository at this point in the history
[FSDP] Enable loading prequantized weights with bf16/fp16/fp32 quant_storage
  • Loading branch information
matthewdouglas authored Jul 29, 2024
2 parents 5cc91b1 + a96d2f0 commit 3a6911f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions bitsandbytes/nn/modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ def from_prequantized(
quantized_stats: Dict[str, Any],
requires_grad: bool = False,
device="cuda",
module: Optional["Linear4bit"] = None,
**kwargs,
) -> "Params4bit":
self = torch.Tensor._make_subclass(cls, data.to(device))
Expand All @@ -284,6 +285,10 @@ def from_prequantized(
self.bnb_quantized = True

self.quant_storage = data.dtype
self.module = module

if self.module is not None:
self.module.quant_state = self.quant_state

return self

Expand Down

0 comments on commit 3a6911f

Please sign in to comment.