diff options
author | Ondřej Čertík <ondrej@certik.us> | 2024-03-14 04:40:14 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-14 12:40:14 +0200 |
commit | 3ca23481dd309bd51cc31c73a4cc34f922cc372f (patch) | |
tree | eab44b8528241eab625347f2a5791a3f64d682d0 /gguf-py/gguf/gguf_reader.py | |
parent | 3fe8d7a17f84bd721cd4d8db35365da44b69f68b (diff) |
gguf-py : add support for I8, I16 and I32 (#6045)
* Refactor dtype handling to be extensible
This code is equivalent as before, but now it is prepared to easily add
more NumPy dtypes.
* Add support for I8, I16 and I32
These types are allowed in the GGUF specification.
* Add support for I8, I16 and I32 to gguf_writer
* Add support for I8, I16, I32 to gguf_reader
Diffstat (limited to 'gguf-py/gguf/gguf_reader.py')
-rw-r--r-- | gguf-py/gguf/gguf_reader.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/gguf-py/gguf/gguf_reader.py b/gguf-py/gguf/gguf_reader.py index 5b6d4ba6..1c10f575 100644 --- a/gguf-py/gguf/gguf_reader.py +++ b/gguf-py/gguf/gguf_reader.py @@ -248,6 +248,15 @@ class GGUFReader: elif ggml_type == GGMLQuantizationType.F16: item_count = n_elems item_type = np.float16 + elif ggml_type == GGMLQuantizationType.I8: + item_count = n_elems + item_type = np.int8 + elif ggml_type == GGMLQuantizationType.I16: + item_count = n_elems + item_type = np.int16 + elif ggml_type == GGMLQuantizationType.I32: + item_count = n_elems + item_type = np.int32 else: item_count = n_bytes item_type = np.uint8 |