download_missing must fetch record.json too (.bin-only filter broke restore); rehearsal pre-cleans stale test repo
Browse files- build/hubsync.py +5 -1
- build/smoke_hub_resume.py +14 -0
build/hubsync.py
CHANGED
|
@@ -118,7 +118,11 @@ def download_missing(root, keys_wanted, repo, remote=None):
|
|
| 118 |
remote = remote if remote is not None else remote_stage_files(repo)
|
| 119 |
got = {}
|
| 120 |
for key in keys_wanted:
|
| 121 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 122 |
if not want:
|
| 123 |
got[key] = []
|
| 124 |
continue
|
|
|
|
| 118 |
remote = remote if remote is not None else remote_stage_files(repo)
|
| 119 |
got = {}
|
| 120 |
for key in keys_wanted:
|
| 121 |
+
# .json must come down too: record.json is what tells the restore the shard list, token count
|
| 122 |
+
# and drop stats. A .bin-only filter made every restored source look unknown and was the actual
|
| 123 |
+
# cause of "restored 0 staged source(s)" in rehearsal v3, with the files plainly present.
|
| 124 |
+
want = sorted(p for p in remote
|
| 125 |
+
if p.startswith(f"stage/{key}/") and p.endswith((".bin", ".json")))
|
| 126 |
if not want:
|
| 127 |
got[key] = []
|
| 128 |
continue
|
build/smoke_hub_resume.py
CHANGED
|
@@ -54,6 +54,20 @@ def main():
|
|
| 54 |
base = ["build_mix.py", "--root", ROOT, "--only", TWO, "--cap-tokens-per-source", "1200000",
|
| 55 |
"--hub-repo", REPO]
|
| 56 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
shutil.rmtree(ROOT, ignore_errors=True)
|
| 58 |
r1 = sh(base + ["--stage-only"], "1. stage two sources and publish")
|
| 59 |
R["stage"] = {"rc": r1["rc"], "json": grab_json(r1["out"], "BUILD_JSON_BEGIN", "BUILD_JSON_END")}
|
|
|
|
| 54 |
base = ["build_mix.py", "--root", ROOT, "--only", TWO, "--cap-tokens-per-source", "1200000",
|
| 55 |
"--hub-repo", REPO]
|
| 56 |
|
| 57 |
+
# Start from an empty stage repo. v3 of this rehearsal failed and, by design, KEPT the repo as
|
| 58 |
+
# evidence; without this the next run would restore those sources and skip the staging step it is
|
| 59 |
+
# meant to be testing.
|
| 60 |
+
def preclean():
|
| 61 |
+
import ounce100m_credentials
|
| 62 |
+
ounce100m_credentials.install()
|
| 63 |
+
from huggingface_hub import delete_repo
|
| 64 |
+
try:
|
| 65 |
+
delete_repo(repo_id=REPO, repo_type="dataset", token=os.environ["HF_TOKEN"])
|
| 66 |
+
return "deleted stale test repo"
|
| 67 |
+
except Exception as e:
|
| 68 |
+
return f"nothing to delete ({type(e).__name__})"
|
| 69 |
+
|
| 70 |
+
R["preclean"] = preclean()
|
| 71 |
shutil.rmtree(ROOT, ignore_errors=True)
|
| 72 |
r1 = sh(base + ["--stage-only"], "1. stage two sources and publish")
|
| 73 |
R["stage"] = {"rc": r1["rc"], "json": grab_json(r1["out"], "BUILD_JSON_BEGIN", "BUILD_JSON_END")}
|