Try to handle overflow due to buggy Windows Python with a better error message

This commit is contained in:
KerfuffleV2 2023-08-22 15:57:49 -06:00
parent bb58495e89
commit f382606a13

View file

@ -1,10 +1,12 @@
import sys, struct, math, argparse import sys, struct, math, argparse, warnings
from pathlib import Path from pathlib import Path
import numpy as np import numpy as np
import gguf import gguf
warnings.filterwarnings('error')
# Note: Does not support GGML_QKK_64 # Note: Does not support GGML_QKK_64
QK_K = 256 QK_K = 256
# Items here are (block size, type size) # Items here are (block size, type size)
@ -325,7 +327,11 @@ def main():
data = np.memmap(cfg.input, mode = 'r') data = np.memmap(cfg.input, mode = 'r')
model = GGMLV3Model() model = GGMLV3Model()
print('* Scanning GGML input file') print('* Scanning GGML input file')
offset = model.load(data, 0) 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
print(f'* GGML model hyperparameters: {model.hyperparameters}') print(f'* GGML model hyperparameters: {model.hyperparameters}')
vocab_override = None vocab_override = None
params_override = None params_override = None