Skip to content

Commit 2ef4185

Browse files
committed
convert : for FP8, use scale type to decide auto type
1 parent f88a4b9 commit 2ef4185

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

convert_hf_to_gguf.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,11 +399,13 @@ def dequant_gptq(g_idx: Tensor, qweight: Tensor, qzeros: Tensor, scales: Tensor)
399399
weight_name = name.removesuffix("_scale_inv")
400400
w = self.model_tensors[weight_name]
401401
s = self.model_tensors[name]
402+
# TODO: change to FP8 once natively supported
403+
auto_qtype = s.auto_qtype if s.auto_qtype is not gguf.GGMLQuantizationType.F32 else gguf.GGMLQuantizationType.BF16
402404
self.model_tensors[weight_name] = ModelTensorInfo(
403405
load=lambda w=w, s=s: dequant_simple(w.load(), s.load()),
404406
size=w.size,
405407
src_type=w.src_type,
406-
auto_qtype=gguf.GGMLQuantizationType.BF16, # TODO: change to FP8 once natively supported
408+
auto_qtype=auto_qtype,
407409
)
408410
tensors_to_remove.append(name)
409411
elif quant_method == "gptq":

0 commit comments

Comments
 (0)