Skip to content

Commit

Permalink
Expose hf_quantize() (#888)
Browse files Browse the repository at this point in the history
* check device_map={"":"auto"}

* torch.mps may not have is_available() in some versions of torch

* cleanup

* add hf_quantize()
  • Loading branch information
ZX-ModelCloud authored Dec 17, 2024
1 parent 0e4893b commit c99638c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions gptqmodel/quantization/gptq.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,17 @@ def add_batch(self, inp, out):
# self.H += 2 / self.nsamples * inp.matmul(inp.t())
self.H += inp.matmul(inp.t())

def hf_quantize(
self,
blocksize=128,
percdamp=0.01,
damp_auto_increment=0.0015,
group_size=-1,
actorder=False,
static_groups=False,
):
return self.quantize(blocksize, percdamp, damp_auto_increment, group_size, actorder, static_groups)

@torch.inference_mode()
def quantize(
self,
Expand Down

0 comments on commit c99638c

Please sign in to comment.