Skip to content

Commit 451e52f

Browse files
committed
fix: Fixes wrong input type for raw_dtype in ggml to gguf scripts
1 parent 1e6f655 commit 451e52f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

gguf-py/gguf/gguf_writer.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ def ggml_pad(x: int, n: int) -> int:
322322

323323
def add_tensor_info(
324324
self, name: str, tensor_shape: Sequence[int], tensor_dtype: np.dtype,
325-
tensor_nbytes: int, raw_dtype: GGMLQuantizationType | None = None,
325+
tensor_nbytes: int, raw_dtype: int | None = None,
326326
) -> None:
327327
if self.state is not WriterState.NO_FILE:
328328
raise ValueError(f'Expected output file to be not yet opened, got {self.state}')
@@ -348,7 +348,7 @@ def add_tensor_info(
348348
else:
349349
raise ValueError("Only F16, F32, F64, I8, I16, I32, I64 tensors are supported for now")
350350
else:
351-
dtype = raw_dtype
351+
dtype = GGMLQuantizationType(raw_dtype)
352352
if tensor_dtype == np.uint8:
353353
tensor_shape = quant_shape_from_byte_shape(tensor_shape, raw_dtype)
354354

@@ -367,7 +367,7 @@ def add_tensor_info(
367367

368368
def add_tensor(
369369
self, name: str, tensor: np.ndarray[Any, Any], raw_shape: Sequence[int] | None = None,
370-
raw_dtype: GGMLQuantizationType | None = None,
370+
raw_dtype: int | None = None,
371371
) -> None:
372372
if self.endianess == GGUFEndian.BIG:
373373
tensor.byteswap(inplace=True)

0 commit comments

Comments
 (0)