Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions gptqmodel/quantization/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

FORMAT_FIELD_CODE = "format"
FORMAT_FIELD_JSON = "checkpoint_format"
FORMAT_FIELD_COMPAT_MARLIN = "is_marlin_format"
QUANT_METHOD_FIELD = "quant_method"
PACK_DTYPE_FIELD = "pack_dtype"
QUANT_CONFIG_FILENAME = "quantize_config.json"
Expand Down Expand Up @@ -184,6 +185,8 @@ class QuantizeConfig():
# pending used field
adapter: Optional[Union[Dict[str, Any], Lora]] = field(default=None)

is_marlin_format: bool = False

def __post_init__(self):
fields_info = fields(self)

Expand Down Expand Up @@ -351,6 +354,8 @@ def from_quant_config(cls, quantize_cfg, format: str = None):
raise ValueError(f"QuantizeConfig: Unknown quantization method: `{val}`.")
else:
normalized[QUANT_METHOD_FIELD] = val
elif key == FORMAT_FIELD_COMPAT_MARLIN and val:
normalized[FORMAT_FIELD_CODE] = FORMAT.MARLIN
elif key in field_names:
normalized[key] = val
else:
Expand Down
7 changes: 4 additions & 3 deletions tests/test_quant_formats.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ def setUpClass(self):

@parameterized.expand(
[
# (QUANT_METHOD.GPTQ, BACKEND.AUTO, False, FORMAT.GPTQ, 8),
(QUANT_METHOD.GPTQ, BACKEND.AUTO, False, FORMAT.GPTQ, 8),
(QUANT_METHOD.GPTQ, BACKEND.EXLLAMA_V2, True, FORMAT.GPTQ_V2, 4),
# (QUANT_METHOD.GPTQ, BACKEND.EXLLAMA_V2, False, FORMAT.GPTQ, 4),
(QUANT_METHOD.GPTQ, BACKEND.EXLLAMA_V2, False, FORMAT.GPTQ, 4),
]
)
def test_quantize(self, method: QUANT_METHOD, backend: BACKEND, sym: bool, format: FORMAT, bits: int):
Expand Down Expand Up @@ -115,12 +115,13 @@ def test_quantize(self, method: QUANT_METHOD, backend: BACKEND, sym: bool, forma
if not sym and format == FORMAT.GPTQ or format == FORMAT.IPEX:
return

# test compat: 1) with simple dict type
# test compat: 1) with simple dict type 2) is_marlin_format
compat_quantize_config = {
"bits": bits,
"group_size": 128,
"sym": sym,
"desc_act": False if format == FORMAT.MARLIN else True,
"is_marlin_format": backend == BACKEND.MARLIN,
}

model = GPTQModel.load(
Expand Down