diff --git a/gguf.py b/gguf.py index c5b2174c9..86c122a5e 100644 --- a/gguf.py +++ b/gguf.py @@ -13,9 +13,9 @@ import numpy as np class GGMLQuantizationType(IntEnum): - F32 = 0 - F16 = 1 - QR_0 = 2 + F32 = 0 + F16 = 1 + Q4_0 = 2 Q4_1 = 3 # Q4_2 = 4 # support has been removed # Q4_3 = 5 # support has been removed @@ -32,16 +32,16 @@ class GGMLQuantizationType(IntEnum): class GGUFValueType(IntEnum): - UINT8 = 0 - INT8 = 1 - UINT16 = 2 - INT16 = 3 - UINT32 = 4 - INT32 = 5 + UINT8 = 0 + INT8 = 1 + UINT16 = 2 + INT16 = 3 + UINT32 = 4 + INT32 = 5 FLOAT32 = 6 - BOOL = 7 - STRING = 8 - ARRAY = 9 + BOOL = 7 + STRING = 8 + ARRAY = 9 @staticmethod def get_type(val): @@ -75,7 +75,9 @@ class GGUFWriter: return cls(f) def write_key(self, key: str): - self.write_val(key, GGUFValueType.STRING) + encoded_key = key.encode("utf8") + self.fout.write(struct.pack("