Browse Source

gguf-py : allow key override when adding value to GGUFWriter (#14194)

Co-authored-by: dinhhuy <huy.dinh@brains-tech.co.jp>
Đinh Trọng Huy 7 tháng trước cách đây
mục cha
commit
4ad243677b
1 tập tin đã thay đổi với 1 bổ sung1 xóa
  1. 1 1
      gguf-py/gguf/gguf_writer.py

+ 1 - 1
gguf-py/gguf/gguf_writer.py

@@ -271,7 +271,7 @@ class GGUFWriter:
 
     def add_key_value(self, key: str, val: Any, vtype: GGUFValueType, sub_type: GGUFValueType | None = None) -> None:
         if any(key in kv_data for kv_data in self.kv_data):
-            raise ValueError(f'Duplicated key name {key!r}')
+            logger.warning(f'Duplicated key name {key!r}, overwriting it with new value {val!r} of type {vtype.name}')
 
         self.kv_data[0][key] = GGUFValue(value=val, type=vtype, sub_type=sub_type)