Skip to content

Commit 4da095e

Browse files
committed
Add support for I8, I16 and I32 to gguf_writer
1 parent 2d85ba2 commit 4da095e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

gguf-py/gguf/gguf_writer.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,14 @@ def add_tensor_info(
208208
dtype = GGMLQuantizationType.F32
209209
elif tensor_dtype == np.float16:
210210
dtype = GGMLQuantizationType.F16
211+
elif tensor_dtype == np.int8:
212+
dtype = GGMLQuantizationType.I8
213+
elif tensor_dtype == np.int16:
214+
dtype = GGMLQuantizationType.I16
215+
elif tensor_dtype == np.int32:
216+
dtype = GGMLQuantizationType.I32
211217
else:
212-
raise ValueError("Only F32 and F16 tensors are supported for now")
218+
raise ValueError("Only F32, F16, I8, I16, I32 tensors are supported for now")
213219
else:
214220
dtype = raw_dtype
215221
self.ti_data += self._pack("I", dtype)

0 commit comments

Comments
 (0)