File size: 1,514 Bytes
27e6b24 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | """Push inventories, code, logs, results and the checkpoint to the Hub repos."""
import os
from huggingface_hub import HfApi
api = HfApi()
DS = "Rami/searchdiff-sat-inventory"
MD = "Rami/searchdiff-sat-repro"
def up(local, remote, repo, typ):
if not os.path.exists(local):
print("MISSING (skip):", local)
return
api.upload_file(path_or_fileobj=local, path_in_repo=remote, repo_id=repo,
repo_type=typ, commit_message=f"add {remote}")
print("pushed", remote, "->", repo)
# dataset repo: inventories + results + logs
for f in ["train_sat.jsonl", "val_sat.jsonl", "test_all.jsonl"]:
up(f"/work/data/{f}", f"data/{f}", DS, "dataset")
for f in ["summary.json", "per_formula.json"]:
up(f"/work/results/{f}", f"results/{f}", DS, "dataset")
up("/work/train_full.log", "logs/train_full.log", DS, "dataset")
up("/work/eval_full.log", "logs/eval_full.log", DS, "dataset")
# model repo: code + checkpoint + readme
for f in ["sat_core.py", "gen_data.py", "train_mdm.py", "sample_eval.py", "push_artifacts.py"]:
up(f"/work/{f}", f, MD, "model")
up("/work/mdm_sat.pt", "mdm_sat.pt", MD, "model")
up("/work/README.md", "README.md", MD, "model")
up("/work/results/summary.json", "results_summary.json", MD, "model")
for repo, typ in ((DS, "dataset"), (MD, "model")):
try:
api.create_tag(repo_id=repo, repo_type=typ, tag="ml-intern")
print("tagged", repo)
except Exception as e:
print("tag failed (non-fatal):", repo, e)
print("DONE")
|