Spaces:
Runtime error
Runtime error
UI-only mode: update scripts/run_online_daemon.py
Browse files1234510 unmodified lines1617181920218 unmodified lines3031323334353637383940414 unmodified lines464748495051525354555657585960#!/usr/bin/env python3"""Periodically run space/scripts/run_space_eval.py (1-hour live benchmark loop)."""from __future__ import annotations10 unmodified linesSPACE_ROOT = Path(__file__).resolve().parents[1]EVAL_SCRIPT = SPACE_ROOT / "scripts" / "run_space_eval.py"DEFAULT_INTERVAL_SECONDS = int(os.getenv("TSFM_BENCH_INTERVAL_SECONDS",8 unmodified lines"--interval-minutes",type=int,default=max(1, DEFAULT_INTERVAL_SECONDS // 60),help="Minutes between collect + eval cycles (default: 60)",)parser.add_argument("--once",action="store_true",help="Run a single evaluation and exit",)return parser.parse_args()4 unmodified linesreturn subprocess.run(cmd, cwd=str(SPACE_ROOT), check=False).returncodedef main() -> None:args = parse_args()if args.once:raise SystemExit(run_eval())while True:code = run_eval()if code != 0:logger.error("Evaluation failed with exit code %s", code)logger.info("Sleeping %s minutes until next cycle", args.interval_minutes)time.sleep(args.interval_minutes * 60)1234510 unmodified lines161718192021228 unmodified lines313233343536373839404142434445464748495051524 unmodified lines57585960616263646566676869707172737475767778798081828384858687888990919293#!/usr/bin/env python3"""Local 1-hour loop: run eval locally, then push results to HF Space."""from __future__ import annotations10 unmodified linesSPACE_ROOT = Path(__file__).resolve().parents[1]EVAL_SCRIPT = SPACE_ROOT / "scripts" / "run_space_eval.py"PUSH_SCRIPT = SPACE_ROOT / "scripts" / "push_results_to_hf.py"DEFAULT_INTERVAL_SECONDS = int(os.getenv("TSFM_BENCH_INTERVAL_SECONDS",8 unmodified lines"--interval-minutes",type=int,default=max(1, DEFAULT_INTERVAL_SECONDS // 60),help="Minutes between collect + eval + push cycles (default: 60)",)parser.add_argument("--once",action="store_true",help="Run a single evaluation (+ push) and exit",)parser.add_argument("--no-push",action="store_true",help="Skip pushing results to Hugging Face",)parser.add_argument("--hf-endpoint",default=os.getenv("HF_ENDPOINT", "https://huggingface.co"),help="HF API endpoint for upload",)return parser.parse_args()4 unmodified linesreturn subprocess.run(cmd, cwd=str(SPACE_ROOT), check=False).returncodedef push_results(endpoint: str) -> int:cmd = [sys.executable,str(PUSH_SCRIPT),"--endpoint",endpoint,]logger.info("Pushing results to HF Space")return subprocess.run(cmd, cwd=str(SPACE_ROOT), check=False).returncodedef run_cycle(args: argparse.Namespace) -> int:code = run_eval()if code != 0:logger.error("Evaluation failed with exit code %s", code)return codeif args.no_push:return 0push_code = push_results(args.hf_endpoint)if push_code != 0:logger.error("HF push failed with exit code %s", push_code)return push_codedef main() -> None:args = parse_args()if args.once:raise SystemExit(run_cycle(args))while True:run_cycle(args)logger.info("Sleeping %s minutes until next cycle", args.interval_minutes)time.sleep(args.interval_minutes * 60)
scripts/run_online_daemon.py+40-7