Skip to content

Commit f737420

Browse files
committed
Fix ggml to gguf conversion on Windows
This fixes `RuntimeWarning: overflow encountered in long_scalars` Credit: anon (not mine)
1 parent f5fe98d commit f737420

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

convert-llama-ggmlv3-to-gguf.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def load(self, data, offset):
9595
pad = ((offset + 31) & ~31) - offset
9696
offset += pad
9797
n_elems = np.prod(self.dims)
98-
n_bytes = (n_elems * tysize) // blksize
98+
n_bytes = np.int64(np.int64(n_elems) * np.int64(tysize)) // np.int64(blksize)
9999
self.start_offset = offset
100100
self.len_bytes = n_bytes
101101
offset += n_bytes
@@ -327,11 +327,7 @@ def main():
327327
data = np.memmap(cfg.input, mode = 'r')
328328
model = GGMLV3Model()
329329
print('* Scanning GGML input file')
330-
try:
331-
offset = model.load(data, 0)
332-
except OverflowError:
333-
print(f'!!! Caught overflow loading tensors. The most likely issue is running on Windows but not in WSL. Try running in WSL if possible.', file = sys.stderr)
334-
raise
330+
offset = model.load(data, 0)
335331
print(f'* GGML model hyperparameters: {model.hyperparameters}')
336332
vocab_override = None
337333
params_override = None

0 commit comments

Comments
 (0)