Skip to content

Commit 833d03c

Browse files
committed
convert : for FP8, use scale type to decide auto type
1 parent 34680f0 commit 833d03c

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
@@ -376,11 +376,13 @@ def dequant_gptq(g_idx: Tensor, qweight: Tensor, qzeros: Tensor, scales: Tensor)
376376
weight_name = name.removesuffix("_scale_inv")
377377
w = self.model_tensors[weight_name]
378378
s = self.model_tensors[name]
379+
# TODO: change to FP8 once natively supported
380+
auto_qtype = s.auto_qtype if s.auto_qtype is not gguf.GGMLQuantizationType.F32 else gguf.GGMLQuantizationType.BF16
379381
self.model_tensors[weight_name] = ModelTensorInfo(
380382
load=lambda w=w, s=s: dequant_simple(w.load(), s.load()),
381383
size=w.size,
382384
src_type=w.src_type,
383-
auto_qtype=gguf.GGMLQuantizationType.BF16, # TODO: change to FP8 once natively supported
385+
auto_qtype=auto_qtype,
384386
)
385387
tensors_to_remove.append(name)
386388
elif quant_method == "gptq":

0 commit comments

Comments
 (0)