Skip to content

Commit 52d38d8

Browse files
Add the Quantizations Methods.
1 parent 648ea70 commit 52d38d8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

quantllm/utils/benchmark.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,11 @@ def benchmark_quantizer(
6464
"percdamp": 0.01,
6565
"block_size": 128,
6666
})
67+
# Create a deep copy of the model using state dict
68+
model_clone = type(self.model)(self.model.config)
69+
model_clone.load_state_dict(self.model.state_dict())
6770

68-
# Initialize quantizer with model on CPU
69-
model_clone = self.model.clone()
71+
# Initialize quantizer with model copy on CPU
7072
quantizer = quantizer_class(model=model_clone, **mem_efficient_args)
7173

7274
# Move to device for quantization

0 commit comments

Comments
 (0)