add push_artifacts.py
Browse files123456789101112131415161718192021222324252627282930313233343536373839"""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 + logsfor 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 + readmefor 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")push_artifacts.pyAdded+39