Spaces:
Running on Zero
Running on Zero
Results: direct to mirror repo + PR best-effort to public
Browse files32 unmodified lines33343536373833 unmodified lines727374757677787980818283848544 unmodified lines13013113213313413513613713813914014114214332 unmodified linesfrom huggingface_hub import HfApiREPO_ID = "Neurips-2026-MLIntern-Repro/trajwiki-table10-repro"SPACE_ID = "Neurips-2026-MLIntern-Repro/trajwiki-executor"MIRROR_ID = "Frame17/trajwiki-executor-private"SHARED_FILES = ["Dockerfile", "executor_entrypoint.py"]33 unmodified linesreturn HfApi(token=token)def push_file(name: str, data: bytes) -> str:ts = datetime.now(timezone.utc).strftime("%Y%m%dT%H%M%SZ")path_in_repo = f"logs/{ts}_{name}"hf_api().upload_file(path_or_fileobj=data, path_in_repo=path_in_repo,repo_id=REPO_ID, repo_type="dataset",)return f"https://huggingface.co/datasets/{REPO_ID}/blob/main/{path_in_repo}"def push_result(stage: str, payload: dict) -> dict:44 unmodified linesname = "category_1_multi_hop.jsonl"data_dir = WORK / "locomo"data_dir.mkdir(parents=True, exist_ok=True)files = api.list_repo_files(repo_id=REPO_ID, repo_type="dataset")match = [f for f in files if f.startswith("logs/") and f.endswith(".jsonl")and "category_1_multi_hop" in f and "data_" in f]if not match:raise RuntimeError("data-stage output not found in bundle repo — run the 'data' stage first")local = api.hf_hub_download(repo_id=REPO_ID, repo_type="dataset",filename=sorted(match)[-1])(data_dir / name).write_bytes(Path(local).read_bytes())repo_dir = WORK / "TrajWiki"with urllib.request.urlopen(TARBALL_URL, timeout=120) as resp:32 unmodified lines333435363738394033 unmodified lines747576777879808182838485868788899091929394959644 unmodified lines14114214314414514614714814915015115215315415515615715815916032 unmodified linesfrom huggingface_hub import HfApiREPO_ID = "Neurips-2026-MLIntern-Repro/trajwiki-table10-repro"DEST_MIRROR = "Frame17/trajwiki-repro-mirror" # user-owned: direct writeDEST_PUBLIC = "Neurips-2026-MLIntern-Repro/trajwiki-table10-repro" # PR best-effortSPACE_ID = "Neurips-2026-MLIntern-Repro/trajwiki-executor"MIRROR_ID = "Frame17/trajwiki-executor-private"SHARED_FILES = ["Dockerfile", "executor_entrypoint.py"]33 unmodified linesreturn HfApi(token=token)def push_file(name: str, data: bytes) -> dict:"""Push to the user-owned mirror repo directly, and best-effort as a PR tothe public bundle repo (org policy may forbid direct main commits)."""ts = datetime.now(timezone.utc).strftime("%Y%m%dT%H%M%SZ")path_in_repo = f"logs/{ts}_{name}"api = hf_api()outcomes: dict = {}for repo_id, create_pr in [(DEST_MIRROR, False), (DEST_PUBLIC, True)]:try:api.upload_file(path_or_fileobj=data, path_in_repo=path_in_repo,repo_id=repo_id, repo_type="dataset", create_pr=create_pr,)outcomes[repo_id] = "ok"except Exception as exc: # noqa: BLE001outcomes[repo_id] = f"error: {str(exc)[:250]}"return {"path_in_repo": path_in_repo, "destinations": outcomes}def push_result(stage: str, payload: dict) -> dict:44 unmodified linesname = "category_1_multi_hop.jsonl"data_dir = WORK / "locomo"data_dir.mkdir(parents=True, exist_ok=True)for repo_id in (DEST_MIRROR, DEST_PUBLIC):try:files = api.list_repo_files(repo_id=repo_id, repo_type="dataset")except Exception: # noqa: BLE001continuematch = [f for f in files if f.startswith("logs/") and f.endswith(".jsonl")and "category_1_multi_hop" in f and "data_" in f]if match:local = api.hf_hub_download(repo_id=repo_id, repo_type="dataset",filename=sorted(match)[-1])(data_dir / name).write_bytes(Path(local).read_bytes())breakelse:raise RuntimeError("data-stage output not found in mirror or bundle repo — run the 'data' stage first")repo_dir = WORK / "TrajWiki"with urllib.request.urlopen(TARBALL_URL, timeout=120) as resp:
executor_entrypoint.py+31-14