Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ktransformers
Commits
8817777e
Commit
8817777e
authored
Feb 26, 2025
by
akemimadoka
Browse files
Fix RuntimeError on Windows caused by integer overflow in np.prod
parent
99f6e421
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
1 deletion
+2
-1
ktransformers/util/custom_gguf.py
ktransformers/util/custom_gguf.py
+2
-1
No files found.
ktransformers/util/custom_gguf.py
View file @
8817777e
...
@@ -27,6 +27,7 @@ import torch
...
@@ -27,6 +27,7 @@ import torch
import
KTransformersOps
import
KTransformersOps
from
.custom_loader
import
SafeTensorLoader
from
.custom_loader
import
SafeTensorLoader
import
ctypes
import
ctypes
import
math
class
GGMLQuantizationType
(
IntEnum
):
class
GGMLQuantizationType
(
IntEnum
):
F32
=
0
F32
=
0
...
@@ -230,7 +231,7 @@ class GGUFLoader:
...
@@ -230,7 +231,7 @@ class GGUFLoader:
shape
=
[
read_value
(
f
,
DATA_TYPES
[
"uint64"
])
for
_
in
range
(
shape_len
)]
shape
=
[
read_value
(
f
,
DATA_TYPES
[
"uint64"
])
for
_
in
range
(
shape_len
)]
ggml_type
=
read_value
(
f
,
DATA_TYPES
[
"uint32"
])
ggml_type
=
read_value
(
f
,
DATA_TYPES
[
"uint32"
])
bad_offset
=
read_value
(
f
,
DATA_TYPES
[
"uint64"
])
bad_offset
=
read_value
(
f
,
DATA_TYPES
[
"uint64"
])
n_elems
=
int
(
np
.
prod
(
shape
))
n_elems
=
int
(
math
.
prod
(
shape
))
block_size
,
type_size
=
GGML_QUANT_SIZES
[
ggml_type
]
block_size
,
type_size
=
GGML_QUANT_SIZES
[
ggml_type
]
n_bytes
=
n_elems
*
type_size
//
block_size
n_bytes
=
n_elems
*
type_size
//
block_size
np_dims
=
tuple
(
reversed
(
shape
))
np_dims
=
tuple
(
reversed
(
shape
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment