Skip to content

Commit

Permalink
fix: Fixes wrong input type for raw_dtype in ggml to gguf scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
farbod committed Aug 8, 2024
1 parent 1e6f655 commit 451e52f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions gguf-py/gguf/gguf_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ def ggml_pad(x: int, n: int) -> int:

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

Expand All @@ -367,7 +367,7 @@ def add_tensor_info(

def add_tensor(
self, name: str, tensor: np.ndarray[Any, Any], raw_shape: Sequence[int] | None = None,
raw_dtype: GGMLQuantizationType | None = None,
raw_dtype: int | None = None,
) -> None:
if self.endianess == GGUFEndian.BIG:
tensor.byteswap(inplace=True)
Expand Down

0 comments on commit 451e52f

Please sign in to comment.