Skip to content

Commit a42b0c2

Browse files
committed
Added changes for __version__ commit
1 parent 42a0f41 commit a42b0c2

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

src/hf_mem/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from importlib.metadata import version
2+
3+
__version__ = version("hf-mem")

src/hf_mem/cli.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
import httpx
1414

15+
from hf_mem import __version__
1516
from hf_mem.gguf import GGUFDtype, GGUFMetadata, fetch_gguf_with_semaphore, gguf_metadata_to_json, merge_shards
1617
from hf_mem.metadata import parse_safetensors_metadata
1718
from hf_mem.print import print_report, print_report_for_gguf

src/hf_mem/print.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from functools import cache
33
from typing import Any, Dict, Literal, Optional
44

5+
from hf_mem import __version__
56
from hf_mem.gguf import GGUFMetadata
67
from hf_mem.metadata import SafetensorsMetadata
78

@@ -338,7 +339,8 @@ def print_report_for_gguf(
338339
max_name_length = min(max([len(filename) for filename in gguf_files.keys()]), MAX_DATA_LEN)
339340
data_col_width = current_len + 2 * BORDERS_AND_PADDING - max_name_length - 5
340341
_print_divider(data_col_width + 1, "top", name_len=max_name_length)
341-
342+
_print_row("VERSION", f"hf-mem {__version__}", data_col_width, name_len=max_name_length)
343+
_print_divider(data_col_width + 1, name_len=max_name_length)
342344
for i, (filename, gguf_metadata) in enumerate(gguf_files.items()):
343345
transformer = gguf_metadata.components.get("Transformer")
344346
if transformer and transformer.dtypes:

0 commit comments

Comments
 (0)