convert : Handle ModelOpt produced mixed precision model during convert to GGUF (#22247)
* Handle ModelOpt produced mixed precision model during convert to GGUF * Apply suggestions from code review Co-authored-by: Sigbjørn Skjæret <sigbjorn.skjaeret@scala.com> * Apply suggestions from code review Co-authored-by: Sigbjørn Skjæret <sigbjorn.skjaeret@scala.com> --------- Co-authored-by: Sigbjørn Skjæret <sigbjorn.skjaeret@scala.com>
This commit is contained in:
@@ -746,7 +746,12 @@ class ModelBase:
|
|||||||
|
|
||||||
if (not quant_algo or not quant_layers) and quant_config_file.is_file():
|
if (not quant_algo or not quant_layers) and quant_config_file.is_file():
|
||||||
with open(quant_config_file, "r", encoding="utf-8") as f:
|
with open(quant_config_file, "r", encoding="utf-8") as f:
|
||||||
quant_config = json.load(f).get("quantization") or {}
|
hf_quant_config = json.load(f)
|
||||||
|
quant_config = hf_quant_config.get("quantization") or {}
|
||||||
|
producer = hf_quant_config.get("producer") or {}
|
||||||
|
producer_name = (producer.get("name") or "").lower()
|
||||||
|
if quant_method is None:
|
||||||
|
self.hparams.setdefault("quantization_config", {})["quant_method"] = producer_name
|
||||||
quant_algo = quant_config.get("quant_algo", quant_algo)
|
quant_algo = quant_config.get("quant_algo", quant_algo)
|
||||||
quant_layers = quant_config.get("quantized_layers", quant_layers) or {}
|
quant_layers = quant_config.get("quantized_layers", quant_layers) or {}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user