aamrinder commited on
Commit
a3f23b7
·
verified ·
1 Parent(s): 402a6aa

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. train/curate_pivot_set.py +19 -0
train/curate_pivot_set.py CHANGED
@@ -122,6 +122,25 @@ def cmd_baseline(args: argparse.Namespace) -> None:
122
  correct = sum(1 for v in out.values() if v["predicted"] == v["gold"])
123
  print(f"[baseline] saved to {args.out}. Text-only accuracy: {correct}/{len(out)} = {correct/len(out):.2%}")
124
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
125
 
126
  # ---------------------------------------------------------------------------
127
  # Step 2: filter — confidently-wrong clips are the Pivot candidates
 
122
  correct = sum(1 for v in out.values() if v["predicted"] == v["gold"])
123
  print(f"[baseline] saved to {args.out}. Text-only accuracy: {correct}/{len(out)} = {correct/len(out):.2%}")
124
 
125
+ # Auto-upload to HF Space so the next step (filter) can pull it.
126
+ # Disabled if NO_HF_UPLOAD=1 or no token available.
127
+ import os
128
+ if not os.environ.get("NO_HF_UPLOAD") and os.environ.get("HF_TOKEN"):
129
+ try:
130
+ from huggingface_hub import HfApi
131
+ repo_id = os.environ.get("HF_REPO_ID", "aamrinder/subtext-arena")
132
+ HfApi().upload_file(
133
+ path_or_fileobj=str(args.out),
134
+ path_in_repo="data/baseline.json",
135
+ repo_id=repo_id,
136
+ repo_type="space",
137
+ token=os.environ["HF_TOKEN"],
138
+ commit_message="add text-only Qwen baseline (curate_pivot_set baseline)",
139
+ )
140
+ print(f"[baseline] uploaded to {repo_id}/data/baseline.json")
141
+ except Exception as e:
142
+ print(f"[baseline] upload failed (saved locally only): {e}")
143
+
144
 
145
  # ---------------------------------------------------------------------------
146
  # Step 2: filter — confidently-wrong clips are the Pivot candidates