Skip to content

Commit

Permalink
gguf-py : numpy 2 newbyteorder fix (ggerganov#9772)
Browse files Browse the repository at this point in the history
  • Loading branch information
jettjaniak authored Dec 13, 2024
1 parent 9f35e44 commit 4601a8b
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions gguf-py/gguf/gguf_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,10 @@ def _get(
count = int(count)
itemsize = int(np.empty([], dtype = dtype).itemsize)
end_offs = offset + itemsize * count
return (
self.data[offset:end_offs]
.view(dtype = dtype)[:count]
.newbyteorder(override_order or self.byte_order)
)
arr = self.data[offset:end_offs].view(dtype=dtype)[:count]
if override_order is None:
return arr
return arr.view(arr.dtype.newbyteorder(override_order))

def _push_field(self, field: ReaderField, skip_sum: bool = False) -> int:
if field.name in self.fields:
Expand Down

0 comments on commit 4601a8b

Please sign in to comment.