Skip to content

Commit 4ad2436

Browse files
huydt84huydt-bti
andauthored
gguf-py : allow key override when adding value to GGUFWriter (#14194)
Co-authored-by: dinhhuy <[email protected]>
1 parent c89c2d1 commit 4ad2436

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

gguf-py/gguf/gguf_writer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ def write_ti_data_to_file(self) -> None:
271271

272272
def add_key_value(self, key: str, val: Any, vtype: GGUFValueType, sub_type: GGUFValueType | None = None) -> None:
273273
if any(key in kv_data for kv_data in self.kv_data):
274-
raise ValueError(f'Duplicated key name {key!r}')
274+
logger.warning(f'Duplicated key name {key!r}, overwriting it with new value {val!r} of type {vtype.name}')
275275

276276
self.kv_data[0][key] = GGUFValue(value=val, type=vtype, sub_type=sub_type)
277277

0 commit comments

Comments
 (0)