Cion-lab commited on
Commit
0538d57
·
verified ·
1 Parent(s): e7ee32a

train: create the ckpt repo if absent before the first push

Browse files
Files changed (1) hide show
  1. train/train_ounce100m.py +4 -0
train/train_ounce100m.py CHANGED
@@ -243,6 +243,10 @@ def main():
243
  ounce100m_credentials.install()
244
  from huggingface_hub import HfApi
245
  api = HfApi()
 
 
 
 
246
  say(f"checkpoint hub target {args.hub_repo} (prune={args.prune}, every {ckpt_every} steps)")
247
 
248
  tacc = TrainingArguments(
 
243
  ounce100m_credentials.install()
244
  from huggingface_hub import HfApi
245
  api = HfApi()
246
+ # Create-if-absent: an upload to a repo nobody made yet is a failure that lands 10 minutes into
247
+ # the first checkpoint, on a GPU session that is being billed while it waits.
248
+ api.create_repo(repo_id=args.hub_repo, repo_type=args.hub_repo_type, exist_ok=True,
249
+ token=os.environ.get("HF_TOKEN"))
250
  say(f"checkpoint hub target {args.hub_repo} (prune={args.prune}, every {ckpt_every} steps)")
251
 
252
  tacc = TrainingArguments(