Skip to content

Commit 84288ff

Browse files
committed
add f16 convert
1 parent 847135a commit 84288ff

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

convert_lora_to_gguf.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,17 @@ def get_tensors(self) -> Iterator[tuple[str, Tensor]]:
139139

140140
# overwrite method
141141
def modify_tensors(self, data_torch: Tensor, name: str, bid: int | None) -> Iterable[tuple[str, Tensor]]:
142+
del bid # unused
142143
return [(name, data_torch)]
143144

145+
# overwrite method
146+
def extra_f16_tensors(self, name: str, new_name: str, bid: int | None, n_dims: int) -> bool:
147+
del name, new_name, bid, n_dims # unused
148+
return True
149+
144150
model_instance.get_tensors = types.MethodType(get_tensors, model_instance)
145151
model_instance.modify_tensors = types.MethodType(modify_tensors, model_instance)
152+
model_instance.extra_f16_tensors = types.MethodType(extra_f16_tensors, model_instance)
146153
model_instance.gguf_writer.add_quantization_version(gguf.GGML_QUANT_VERSION)
147154
logger.info("Exporting model...")
148155
model_instance.write()

0 commit comments

Comments
 (0)