Skip to content

Commit 5d246a7

Browse files
authored
convert : minor fixes for numpy 2.x (ggml-org#23571)
1 parent 63248fc commit 5d246a7

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

examples/convert_legacy_llama.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1308,7 +1308,8 @@ def do_dump_model(model_plus: ModelPlus) -> None:
13081308

13091309
def main(args_in: list[str] | None = None) -> None:
13101310
output_choices = ["f32", "f16"]
1311-
if np.uint32(1) == np.uint32(1).newbyteorder("<"):
1311+
dummy_val = np.uint32(1)
1312+
if dummy_val == dummy_val.view(dummy_val.dtype.newbyteorder("<")):
13121313
# We currently only support Q8_0 output on little endian systems.
13131314
output_choices.append("q8_0")
13141315
parser = argparse.ArgumentParser(description="Convert a LLaMA model to a GGML compatible file")

gguf-py/gguf/quants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ def quant_shape_from_byte_shape(shape: Sequence[int], quant_type: GGMLQuantizati
2828
# This is faster than np.vectorize and np.apply_along_axis because it works on more than one row at a time
2929
def _apply_over_grouped_rows(func: Callable[[np.ndarray], np.ndarray], arr: np.ndarray, otype: DTypeLike, oshape: tuple[int, ...]) -> np.ndarray:
3030
rows = arr.reshape((-1, arr.shape[-1]))
31+
assert len(rows.shape)
3132
osize = 1
3233
for dim in oshape:
3334
osize *= dim

0 commit comments

Comments
 (0)