Download push_artifacts.py from Rami/searchdiff-sat-repro: direct link, hf CLI and curl.
- Browser
- Download file 1.51 kB
-
https://huggingface.co/Rami/searchdiff-sat-repro/resolve/main/push_artifacts.py
- Command line
-
hf download hf://Rami/searchdiff-sat-repro/push_artifacts.py
-
curl -L -o push_artifacts.py https://huggingface.co/Rami/searchdiff-sat-repro/resolve/main/push_artifacts.py
1.51 kB
| """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") | |