suchirsalhan commited on
Commit
d03181c
·
verified ·
1 Parent(s): 0ad18c0

Upload code/publish.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. code/publish.py +21 -0
code/publish.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Publish the merge-accuracy artefacts to Mergeability-2/merge-accuracy (dataset repo)."""
2
+ import os, sys, glob
3
+ from huggingface_hub import HfApi, create_repo
4
+ R = "/root/merge-accuracy"
5
+ REPO = "Mergeability-2/merge-accuracy"
6
+ api = HfApi()
7
+ create_repo(REPO, repo_type="dataset", exist_ok=True)
8
+ files = []
9
+ for p in ["RESULTS_MERGE_ACCURACY.md"]:
10
+ if os.path.exists(f"{R}/{p}"): files.append((f"{R}/{p}", p))
11
+ for p in glob.glob(f"{R}/results/*.csv") + glob.glob(f"{R}/results/*.json") + glob.glob(f"{R}/results/*.jsonl"):
12
+ files.append((p, f"results/{os.path.basename(p)}"))
13
+ for p in glob.glob(f"{R}/figs/*.png"):
14
+ files.append((p, f"figs/{os.path.basename(p)}"))
15
+ for p in ["ma_common.py", "tasks.py", "gmap.py", "chatvec_run.py", "diag_only.py",
16
+ "cv_control.py", "run_pairs.py", "analyze.py", "forks.json", "pairs_r4.json"]:
17
+ if os.path.exists(f"{R}/{p}"): files.append((f"{R}/{p}", f"code/{p}"))
18
+ for local, path in files:
19
+ api.upload_file(path_or_fileobj=local, path_in_repo=path, repo_id=REPO, repo_type="dataset")
20
+ print("uploaded", path)
21
+ print(f"https://huggingface.co/datasets/{REPO}")