Skip to content

Commit

Permalink
type consistency in format_n_bytes_to_str
Browse files Browse the repository at this point in the history
  • Loading branch information
christianazinn committed Jun 6, 2024
1 parent 3328b0a commit 1cbab22
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 @@ -255,9 +255,9 @@ def split_str_to_n_bytes(split_str: str) -> int:
def format_n_bytes_to_str(num: int) -> str:
if num == METADATA_ONLY_INDICATOR:
return "negligible - metadata only"
num = float(num)
fnum = float(num)
for unit in ("", "K", "M", "G"):
if abs(num) < 1024.0:
return f"{num:3.1f}{unit}"
num /= 1024.0
return f"{num:.1f}T - over 1TB, --split recommended"
if abs(fnum) < 1024.0:
return f"{fnum:3.1f}{unit}"
fnum /= 1024.0
return f"{fnum:.1f}T - over 1TB, --split recommended"

0 comments on commit 1cbab22

Please sign in to comment.