Unverified Commit 3a6911fa authored by Matthew Douglas's avatar Matthew Douglas Committed by GitHub
Browse files

Merge pull request #1295 from matthewdouglas/fsdp-load-prequantized

[FSDP] Enable loading prequantized weights with bf16/fp16/fp32 quant_storage
parents 5cc91b1b a96d2f05
...@@ -273,6 +273,7 @@ class Params4bit(torch.nn.Parameter): ...@@ -273,6 +273,7 @@ class Params4bit(torch.nn.Parameter):
quantized_stats: Dict[str, Any], quantized_stats: Dict[str, Any],
requires_grad: bool = False, requires_grad: bool = False,
device="cuda", device="cuda",
module: Optional["Linear4bit"] = None,
**kwargs, **kwargs,
) -> "Params4bit": ) -> "Params4bit":
self = torch.Tensor._make_subclass(cls, data.to(device)) self = torch.Tensor._make_subclass(cls, data.to(device))
...@@ -284,6 +285,10 @@ class Params4bit(torch.nn.Parameter): ...@@ -284,6 +285,10 @@ class Params4bit(torch.nn.Parameter):
self.bnb_quantized = True self.bnb_quantized = True
self.quant_storage = data.dtype self.quant_storage = data.dtype
self.module = module
if self.module is not None:
self.module.quant_state = self.quant_state
return self return self
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment