File size: 2,379 Bytes
49aa045 eeccfb0 49aa045 80833e8 49aa045 c29c900 49aa045 80833e8 49aa045 80833e8 49aa045 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | """Upload only the port's explicit release files to a private HF dataset."""
import argparse
import json
from .adapter import ROOT
def main():
from huggingface_hub import HfApi
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--repo-id", default="HuggingFaceSwarms/AgentEscapeBench-harbor")
args = parser.parse_args()
corpus = json.loads((ROOT / "reports/corpus.json").read_text())
assert corpus["tasks"] == corpus["successes"] == 270
assert len(corpus["templates_executed"]) == 33
isolation = json.loads((ROOT / "reports/worker-isolation.json").read_text())
assert all(row["passed"] for row in isolation)
smoke = json.loads((ROOT / "reports/openenv-smoke.json").read_text())
assert len(smoke["results"]) == 2
assert all(row["ok"] and row["reward"] == 1.0 for row in smoke["results"])
api = HfApi()
api.create_repo(args.repo_id, repo_type="dataset", private=True, exist_ok=True)
info = api.repo_info(args.repo_id, repo_type="dataset")
if not info.private:
raise RuntimeError(
"Refusing to upload to a public dataset; user requested private"
)
result = api.upload_folder(
repo_id=args.repo_id,
repo_type="dataset",
folder_path=ROOT,
commit_message="Port 270 AgentEscapeBench tasks to Harbor with OpenEnv integration",
parent_commit=info.sha,
allow_patterns=[
"README.md",
"LICENSE.port",
"pyproject.toml",
"uv.lock",
"runtime-requirements.txt",
"source-lock.json",
"assets/**",
"src/**",
"data/**",
"tasks/**",
"tests/**",
"reports/corpus.json",
"reports/worker-isolation.json",
"reports/openenv-smoke.json",
"reports/validation-summary.json",
"reports/unit-tests.log",
],
ignore_patterns=["**/__pycache__/**", "**/*.pyc", "**/*.log", "**/.cache/**"],
)
publication = {
"repo_id": args.repo_id,
"private": True,
"revision": result.oid,
"commit_url": result.commit_url,
}
(ROOT / "reports/publication.json").write_text(
json.dumps(publication, indent=2) + "\n"
)
print(json.dumps(publication))
if __name__ == "__main__":
main()
|