Spaces:
Sleeping
Sleeping
Don Rishabh commited on
Commit ·
309fb46
1
Parent(s): 1da121e
eval: --push-to-hub uploads eval JSONL to adapter repo under evals/
Browse files- training/eval_before_after.py +16 -0
- training/hf_job_eval.sh +1 -0
training/eval_before_after.py
CHANGED
|
@@ -51,6 +51,8 @@ def parse_args() -> argparse.Namespace:
|
|
| 51 |
help="Label to tag this eval run (e.g. 'base', 'trained').")
|
| 52 |
p.add_argument("--max-new-tokens", type=int, default=256)
|
| 53 |
p.add_argument("--temperature", type=float, default=0.0)
|
|
|
|
|
|
|
| 54 |
return p.parse_args()
|
| 55 |
|
| 56 |
|
|
@@ -197,6 +199,20 @@ def main() -> None:
|
|
| 197 |
f'{total_tokens/n:6.1f}'
|
| 198 |
)
|
| 199 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 200 |
|
| 201 |
if __name__ == "__main__":
|
| 202 |
main()
|
|
|
|
| 51 |
help="Label to tag this eval run (e.g. 'base', 'trained').")
|
| 52 |
p.add_argument("--max-new-tokens", type=int, default=256)
|
| 53 |
p.add_argument("--temperature", type=float, default=0.0)
|
| 54 |
+
p.add_argument("--push-to-hub", default=None,
|
| 55 |
+
help="HF model repo id to upload the eval JSONL under evals/eval_<label>.jsonl.")
|
| 56 |
return p.parse_args()
|
| 57 |
|
| 58 |
|
|
|
|
| 199 |
f'{total_tokens/n:6.1f}'
|
| 200 |
)
|
| 201 |
|
| 202 |
+
# --- Push JSONL to the hub so the results persist past container death
|
| 203 |
+
if args.push_to_hub:
|
| 204 |
+
from huggingface_hub import HfApi
|
| 205 |
+
api = HfApi()
|
| 206 |
+
api.create_repo(args.push_to_hub, exist_ok=True, repo_type="model")
|
| 207 |
+
api.upload_file(
|
| 208 |
+
path_or_fileobj=str(out_path),
|
| 209 |
+
path_in_repo=f"evals/eval_{args.label}.jsonl",
|
| 210 |
+
repo_id=args.push_to_hub,
|
| 211 |
+
repo_type="model",
|
| 212 |
+
commit_message=f"eval_{args.label}: {len(rows)} episodes",
|
| 213 |
+
)
|
| 214 |
+
print(f"[push] uploaded evals/eval_{args.label}.jsonl to https://huggingface.co/{args.push_to_hub}", flush=True)
|
| 215 |
+
|
| 216 |
|
| 217 |
if __name__ == "__main__":
|
| 218 |
main()
|
training/hf_job_eval.sh
CHANGED
|
@@ -53,6 +53,7 @@ python -u training/eval_before_after.py \
|
|
| 53 |
--seeds-per-task ${SEEDS_PER_TASK} \
|
| 54 |
--label ${LABEL} \
|
| 55 |
--output-json /app/outputs/eval_${LABEL}.jsonl \
|
|
|
|
| 56 |
${EXTRA_FLAGS}
|
| 57 |
EOF
|
| 58 |
|
|
|
|
| 53 |
--seeds-per-task ${SEEDS_PER_TASK} \
|
| 54 |
--label ${LABEL} \
|
| 55 |
--output-json /app/outputs/eval_${LABEL}.jsonl \
|
| 56 |
+
--push-to-hub ${ADAPTER_REPO} \
|
| 57 |
${EXTRA_FLAGS}
|
| 58 |
EOF
|
| 59 |
|