Skip to content

Commit 0422152

Browse files
authored
Merge pull request #670 from akemimadoka/fix-win
Fix RuntimeError on Windows caused by integer overflow in np.prod
2 parents 798e1d0 + 8817777 commit 0422152

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

ktransformers/util/custom_gguf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import KTransformersOps
2828
from .custom_loader import SafeTensorLoader
2929
import ctypes
30+
import math
3031

3132
class GGMLQuantizationType(IntEnum):
3233
F32 = 0
@@ -230,7 +231,7 @@ def load_gguf(self, f):
230231
shape = [read_value(f, DATA_TYPES["uint64"]) for _ in range(shape_len)]
231232
ggml_type = read_value(f, DATA_TYPES["uint32"])
232233
bad_offset = read_value(f, DATA_TYPES["uint64"])
233-
n_elems = int(np.prod(shape))
234+
n_elems = int(math.prod(shape))
234235
block_size, type_size = GGML_QUANT_SIZES[ggml_type]
235236
n_bytes = n_elems * type_size // block_size
236237
np_dims = tuple(reversed(shape))

0 commit comments

Comments
 (0)