merge-accuracy / code /publish.py
suchirsalhan's picture
Upload code/publish.py with huggingface_hub
d03181c verified
Raw
History Blame Contribute Delete
1.12 kB
"""Publish the merge-accuracy artefacts to Mergeability-2/merge-accuracy (dataset repo)."""
import os, sys, glob
from huggingface_hub import HfApi, create_repo
R = "/root/merge-accuracy"
REPO = "Mergeability-2/merge-accuracy"
api = HfApi()
create_repo(REPO, repo_type="dataset", exist_ok=True)
files = []
for p in ["RESULTS_MERGE_ACCURACY.md"]:
if os.path.exists(f"{R}/{p}"): files.append((f"{R}/{p}", p))
for p in glob.glob(f"{R}/results/*.csv") + glob.glob(f"{R}/results/*.json") + glob.glob(f"{R}/results/*.jsonl"):
files.append((p, f"results/{os.path.basename(p)}"))
for p in glob.glob(f"{R}/figs/*.png"):
files.append((p, f"figs/{os.path.basename(p)}"))
for p in ["ma_common.py", "tasks.py", "gmap.py", "chatvec_run.py", "diag_only.py",
"cv_control.py", "run_pairs.py", "analyze.py", "forks.json", "pairs_r4.json"]:
if os.path.exists(f"{R}/{p}"): files.append((f"{R}/{p}", f"code/{p}"))
for local, path in files:
api.upload_file(path_or_fileobj=local, path_in_repo=path, repo_id=REPO, repo_type="dataset")
print("uploaded", path)
print(f"https://huggingface.co/datasets/{REPO}")