Skip to content

Commit

Permalink
base-1024 bytes to base-1000
Browse files Browse the repository at this point in the history
  • Loading branch information
christianazinn committed Jun 6, 2024
1 parent 83e4a3f commit 13ffe22
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions gguf-py/gguf/gguf_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,11 +232,11 @@ def get_tensor_size(tensor) -> int:
@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:
Expand All @@ -253,7 +253,7 @@ def format_n_bytes_to_str(num: int) -> str:
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"

0 comments on commit 13ffe22

Please sign in to comment.