From 1cbab222250999382cc1ab902e1f72bcad8e55b5 Mon Sep 17 00:00:00 2001 From: Christian Zhou-Zheng Date: Thu, 6 Jun 2024 08:43:26 -0400 Subject: [PATCH] type consistency in format_n_bytes_to_str --- gguf-py/gguf/gguf_manager.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gguf-py/gguf/gguf_manager.py b/gguf-py/gguf/gguf_manager.py index e7d2ef096cd49..523a5f500a466 100644 --- a/gguf-py/gguf/gguf_manager.py +++ b/gguf-py/gguf/gguf_manager.py @@ -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" \ No newline at end of file + if abs(fnum) < 1024.0: + return f"{fnum:3.1f}{unit}" + fnum /= 1024.0 + return f"{fnum:.1f}T - over 1TB, --split recommended" \ No newline at end of file