Upload eden_check_hf.py with huggingface_hub
Browse files- eden_check_hf.py +30 -0
eden_check_hf.py
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from huggingface_hub import HfApi, list_repo_files
|
| 2 |
+
|
| 3 |
+
import os
|
| 4 |
+
TOKEN = os.environ.get("HF_TOKEN", "")
|
| 5 |
+
api = HfApi(token=TOKEN)
|
| 6 |
+
|
| 7 |
+
repos = sorted(api.list_models(author="Shanmuk4622"), key=lambda x: x.id)
|
| 8 |
+
print(f"Total repos on HF: {len(repos)}\n")
|
| 9 |
+
|
| 10 |
+
missing_readme = []
|
| 11 |
+
missing_weights = []
|
| 12 |
+
|
| 13 |
+
for r in repos:
|
| 14 |
+
files = list(list_repo_files(r.id, token=TOKEN))
|
| 15 |
+
has_readme = "README.md" in files
|
| 16 |
+
has_weights = any(f.endswith(".pth") for f in files)
|
| 17 |
+
has_csv = any(f.endswith(".csv") for f in files)
|
| 18 |
+
parts = []
|
| 19 |
+
if has_readme: parts.append("README")
|
| 20 |
+
if has_weights: parts.append("weights")
|
| 21 |
+
if has_csv: parts.append("CSV")
|
| 22 |
+
tag = "OK" if (has_readme and has_weights) else "!!"
|
| 23 |
+
name = r.id.replace("Shanmuk4622/", "")
|
| 24 |
+
print(f" [{tag}] {name:<45} [{' + '.join(parts)}]")
|
| 25 |
+
if not has_readme: missing_readme.append(name)
|
| 26 |
+
if not has_weights: missing_weights.append(name)
|
| 27 |
+
|
| 28 |
+
print()
|
| 29 |
+
print(f"Missing README : {missing_readme or 'None'}")
|
| 30 |
+
print(f"Missing weights : {missing_weights or 'None'}")
|