From 7f7ddd5002040804e33fcdbde44aa22f8635f57d Mon Sep 17 00:00:00 2001 From: IgnacioFDM Date: Wed, 23 Aug 2023 06:31:09 -0300 Subject: [PATCH] Fix ggml to gguf conversion on Windows (#2733) This fixes `RuntimeWarning: overflow encountered in long_scalars` Credit: anon (not mine) --- convert-llama-ggmlv3-to-gguf.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/convert-llama-ggmlv3-to-gguf.py b/convert-llama-ggmlv3-to-gguf.py index 5b038fc0a..86d459680 100644 --- a/convert-llama-ggmlv3-to-gguf.py +++ b/convert-llama-ggmlv3-to-gguf.py @@ -1,12 +1,10 @@ -import sys, struct, math, argparse, warnings +import sys, struct, math, argparse from pathlib import Path import numpy as np import gguf -warnings.filterwarnings('error') - # Note: Does not support GGML_QKK_64 QK_K = 256 # Items here are (block size, type size) @@ -95,7 +93,7 @@ class Tensor: pad = ((offset + 31) & ~31) - offset offset += pad n_elems = np.prod(self.dims) - n_bytes = (n_elems * tysize) // blksize + n_bytes = np.int64(np.int64(n_elems) * np.int64(tysize)) // np.int64(blksize) self.start_offset = offset self.len_bytes = n_bytes offset += n_bytes @@ -327,11 +325,7 @@ def main(): data = np.memmap(cfg.input, mode = 'r') model = GGMLV3Model() print('* Scanning GGML input file') - try: - offset = model.load(data, 0) - except OverflowError: - 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) - raise + offset = model.load(data, 0) print(f'* GGML model hyperparameters: {model.hyperparameters}') vocab_override = None params_override = None