base-1024 bytes to base-1000

This commit is contained in:
Christian Zhou-Zheng 2024-06-06 10:24:11 -04:00
parent 83e4a3f5cc
commit 13ffe22ca7

View file

@ -232,11 +232,11 @@ class GGUFManager(GGUFWriter):
@staticmethod
def split_str_to_n_bytes(split_str: str) -> int:
if split_str.endswith("K"):
n = int(split_str[:-1]) * 1024
n = int(split_str[:-1]) * 1000
elif split_str.endswith("M"):
n = int(split_str[:-1]) * 1024 * 1024
n = int(split_str[:-1]) * 1000 * 1000
elif split_str.endswith("G"):
n = int(split_str[:-1]) * 1024 * 1024 * 1024
n = int(split_str[:-1]) * 1000 * 1000 * 1000
elif split_str.isnumeric():
n = int(split_str)
else:
@ -253,7 +253,7 @@ class GGUFManager(GGUFWriter):
return "negligible - metadata only"
fnum = float(num)
for unit in ("", "K", "M", "G"):
if abs(fnum) < 1024.0:
if abs(fnum) < 1000.0:
return f"{fnum:3.1f}{unit}"
fnum /= 1024.0
fnum /= 1000.0
return f"{fnum:.1f}T - over 1TB, --split recommended"