Skip to content

Commit

Permalink
Add support for I8, I16 and I32 to gguf_writer
Browse files Browse the repository at this point in the history
  • Loading branch information
certik committed Mar 13, 2024
1 parent 2d85ba2 commit 4da095e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion gguf-py/gguf/gguf_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,14 @@ def add_tensor_info(
dtype = GGMLQuantizationType.F32
elif tensor_dtype == np.float16:
dtype = GGMLQuantizationType.F16
elif tensor_dtype == np.int8:
dtype = GGMLQuantizationType.I8
elif tensor_dtype == np.int16:
dtype = GGMLQuantizationType.I16
elif tensor_dtype == np.int32:
dtype = GGMLQuantizationType.I32
else:
raise ValueError("Only F32 and F16 tensors are supported for now")
raise ValueError("Only F32, F16, I8, I16, I32 tensors are supported for now")
else:
dtype = raw_dtype
self.ti_data += self._pack("I", dtype)
Expand Down

0 comments on commit 4da095e

Please sign in to comment.