Cion-lab commited on
Commit
dd1b6b9
·
verified ·
1 Parent(s): 9a70e6c

publish_model: take the checkpoint source from --ckpt-repo instead of a hard-coded repo name

Browse files
Files changed (1) hide show
  1. build/publish_model.py +10 -3
build/publish_model.py CHANGED
@@ -19,6 +19,9 @@ import sys
19
  import urllib.request
20
 
21
  MIX = "Cion-lab/ounce100m-mix-v1"
 
 
 
22
  CKPT = "Cion-lab/ounce100m-ckpt"
23
  CARD_FILES = ("config.json", "model.safetensors", "tokenizer.json", "tokenizer_config.json",
24
  "special_tokens_map.json", "vocab.json", "merges.txt", "cursor.json",
@@ -188,6 +191,8 @@ def main():
188
  ap.add_argument("--repo", default="Cion-lab/ounce100m-v1")
189
  ap.add_argument("--src", default="/kaggle/working/mixroot", help="mix root (for tokenizer.json)")
190
  ap.add_argument("--from-dir", default="", help="local dir holding the trainer's final/ export")
 
 
191
  ap.add_argument("--verify-only", action="store_true",
192
  help="fresh-instance clean-room test: download the published repo and load it")
193
  ap.add_argument("--dry-run", action="store_true")
@@ -251,9 +256,11 @@ def main():
251
 
252
  src = a.from_dir
253
  if not src:
254
- ptr = get_json(f"https://huggingface.co/datasets/{CKPT}/resolve/main/latest.json", tok)
255
- print("ckpt latest.json ->", {k: ptr.get(k) for k in ("step", "path_in_repo")}, flush=True)
256
- src = snapshot_download(CKPT, repo_type="dataset", allow_patterns=[ptr["path_in_repo"] + "/*"],
 
 
257
  local_dir="/kaggle/working/from_hub")
258
  src = os.path.join(src, ptr["path_in_repo"])
259
  have = {f for f in os.listdir(src) if os.path.isfile(os.path.join(src, f))}
 
19
  import urllib.request
20
 
21
  MIX = "Cion-lab/ounce100m-mix-v1"
22
+ # A default, not a constant: this run's checkpoint repo, hard-coded as the only source, let the publisher
23
+ # fetch `latest.json` from a repo the operator never pointed at -- for a second model that is publishing one
24
+ # run's weights into another run's repo. Override with --ckpt-repo, or bypass it with --from-dir.
25
  CKPT = "Cion-lab/ounce100m-ckpt"
26
  CARD_FILES = ("config.json", "model.safetensors", "tokenizer.json", "tokenizer_config.json",
27
  "special_tokens_map.json", "vocab.json", "merges.txt", "cursor.json",
 
191
  ap.add_argument("--repo", default="Cion-lab/ounce100m-v1")
192
  ap.add_argument("--src", default="/kaggle/working/mixroot", help="mix root (for tokenizer.json)")
193
  ap.add_argument("--from-dir", default="", help="local dir holding the trainer's final/ export")
194
+ ap.add_argument("--ckpt-repo", default=CKPT,
195
+ help="dataset repo whose latest.json names the export to publish (ignored with --from-dir)")
196
  ap.add_argument("--verify-only", action="store_true",
197
  help="fresh-instance clean-room test: download the published repo and load it")
198
  ap.add_argument("--dry-run", action="store_true")
 
256
 
257
  src = a.from_dir
258
  if not src:
259
+ ptr = get_json(f"https://huggingface.co/datasets/{a.ckpt_repo}/resolve/main/latest.json", tok)
260
+ print("ckpt latest.json ->", {"repo": a.ckpt_repo,
261
+ **{k: ptr.get(k) for k in ("step", "path_in_repo")}}, flush=True)
262
+ src = snapshot_download(a.ckpt_repo, repo_type="dataset",
263
+ allow_patterns=[ptr["path_in_repo"] + "/*"],
264
  local_dir="/kaggle/working/from_hub")
265
  src = os.path.join(src, ptr["path_in_repo"])
266
  have = {f for f in os.listdir(src) if os.path.isfile(os.path.join(src, f))}