Skip to content

Commit

Permalink
Fix FOAK dequant for compatibility with local gptq package
Browse files Browse the repository at this point in the history
  • Loading branch information
achew010 committed Jul 11, 2024
1 parent 0858912 commit 1f35ea4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ def get_lora_parameters(proj):
base_layer = proj.base_layer if hasattr(proj, "base_layer") else proj
qstate = extract_gptq_state(base_layer)

if base_layer.__module__.startswith("auto_gptq"):
setattr(qstate.qzeros, "offset", 1)

if not hasattr(proj, "disable_adapters") or proj.disable_adapters or proj.merged:
return qstate, None, None, None, None

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,10 @@ def dequant_kernel_248(
zeros = zeros & maxq

# Dequantize
zeros = zeros + 1
# None if using local gptqpackage, official autogptq should have an offset value
if getattr(qzeros_ptr, "offset", None) is not None:
zeros = zeros + qzeros_ptr.offset

weights = weights - zeros
weights = weights.to(tl.float32)
weights = scales * weights
Expand Down

0 comments on commit 1f35ea4

Please sign in to comment.