Spaces:
Running
Running
kovacsvi
commited on
Commit
·
44d3c68
1
Parent(s):
6964453
scan_cache (huggingface_hub)
Browse files
utils.py
CHANGED
@@ -22,6 +22,8 @@ from interfaces.ontolisst import build_huggingface_path as hf_ontlisst_path
|
|
22 |
from interfaces.illframes import build_huggingface_path as hf_illframes_path
|
23 |
from interfaces.ontolisst import build_huggingface_path as hf_ontolisst_path
|
24 |
|
|
|
|
|
25 |
HF_TOKEN = os.environ["hf_read"]
|
26 |
|
27 |
# should be a temporary solution
|
@@ -59,9 +61,14 @@ def df_h():
|
|
59 |
print(result.stdout)
|
60 |
|
61 |
def scan_cache():
|
62 |
-
|
63 |
-
|
64 |
|
|
|
|
|
|
|
|
|
|
|
65 |
|
66 |
def set_hf_cache_dir(path:str):
|
67 |
os.environ['TRANSFORMERS_CACHE'] = path
|
|
|
22 |
from interfaces.illframes import build_huggingface_path as hf_illframes_path
|
23 |
from interfaces.ontolisst import build_huggingface_path as hf_ontolisst_path
|
24 |
|
25 |
+
from huggingface_hub import scan_cache_dir
|
26 |
+
|
27 |
HF_TOKEN = os.environ["hf_read"]
|
28 |
|
29 |
# should be a temporary solution
|
|
|
61 |
print(result.stdout)
|
62 |
|
63 |
def scan_cache():
|
64 |
+
cache_dir = os.environ.get("TRANSFORMERS_CACHE", os.path.expanduser("~/.cache/huggingface/transformers"))
|
65 |
+
scan_result = scan_cache_dir(cache_dir)
|
66 |
|
67 |
+
print("=== Model Cache Report ===")
|
68 |
+
print(f"Cache size: {scan_result.size_on_disk / 1e6:.2f} MB")
|
69 |
+
print(f"Number of repos: {len(scan_result.repos)}")
|
70 |
+
for repo in scan_result.repos:
|
71 |
+
print(f"- {repo.repo_id} ({repo.repo_type}) — {repo.size_on_disk / 1e6:.2f} MB")
|
72 |
|
73 |
def set_hf_cache_dir(path:str):
|
74 |
os.environ['TRANSFORMERS_CACHE'] = path
|