Publish pinned LCB-v6 downloader
Browse files- README.md +3 -1
- download_lcb_v6-323216b.py +168 -0
- simct-b200-portable.bundle +2 -2
- source-manifest.json +8 -4
README.md
CHANGED
|
@@ -12,7 +12,7 @@ This repository stores a Git bundle, not a direct Git branch mirror.
|
|
| 12 |
The HF Git server rejects ordinary historical image blobs. The bundle retains the original code commit and complete Git history.
|
| 13 |
|
| 14 |
- Branch: vdt/ops/b200-portable
|
| 15 |
-
- Commit:
|
| 16 |
- Source repository: https://github.com/sontungkieu/SimCT
|
| 17 |
- Runtime, checkpoints, datasets and untracked remote_artifacts are excluded.
|
| 18 |
|
|
@@ -38,3 +38,5 @@ Server launchers and port fixes are integrated under experiments/runai. See expe
|
|
| 38 |
|
| 39 |
MP-OPD launcher uses microbatch 4. Evaluation runner has explicit author-code and paper-spec profiles.
|
| 40 |
Independent eval source archive: simct-eval-94114c1.zip. Extract into a new eval directory; do not update the active training checkout. See scripts/evaluation/CONTRACT_README.md. CPU tests passed; paper math requires math-verify, company preflight and dataset verification remain pending. No GPU evaluation was run.
|
|
|
|
|
|
|
|
|
| 12 |
The HF Git server rejects ordinary historical image blobs. The bundle retains the original code commit and complete Git history.
|
| 13 |
|
| 14 |
- Branch: vdt/ops/b200-portable
|
| 15 |
+
- Commit: 323216b038b91f93fb5f311d953b52862939d4a3
|
| 16 |
- Source repository: https://github.com/sontungkieu/SimCT
|
| 17 |
- Runtime, checkpoints, datasets and untracked remote_artifacts are excluded.
|
| 18 |
|
|
|
|
| 38 |
|
| 39 |
MP-OPD launcher uses microbatch 4. Evaluation runner has explicit author-code and paper-spec profiles.
|
| 40 |
Independent eval source archive: simct-eval-94114c1.zip. Extract into a new eval directory; do not update the active training checkout. See scripts/evaluation/CONTRACT_README.md. CPU tests passed; paper math requires math-verify, company preflight and dataset verification remain pending. No GPU evaluation was run.
|
| 41 |
+
|
| 42 |
+
Pinned LCB-v6 downloader: download_lcb_v6-323216b.py. Data downloading runs on company storage, not on the personal machine.
|
download_lcb_v6-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
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Download official LCB release_v6 raw shards; stdlib only, no GPU or dataset scripts."""
|
| 3 |
+
import argparse
|
| 4 |
+
import hashlib
|
| 5 |
+
import json
|
| 6 |
+
import os
|
| 7 |
+
import shutil
|
| 8 |
+
import urllib.request
|
| 9 |
+
from pathlib import Path
|
| 10 |
+
|
| 11 |
+
REVISION = "0fe84c3912ea0c4d4a78037083943e8f0c4dd505"
|
| 12 |
+
BASE = f"https://huggingface.co/datasets/livecodebench/code_generation_lite/resolve/{REVISION}/"
|
| 13 |
+
# HF LFS SHA256 and sizes, verified via HF tree API at this immutable revision.
|
| 14 |
+
# ALLOWED_FILES['release_v6'] in code_generation_lite.py lists all six shards.
|
| 15 |
+
SHARDS = [
|
| 16 |
+
("test.jsonl", 1252609773, "2bd02b38beb48e8c46b5b9987095d999ff38cd8efc255ea5d58974317c48f63f"),
|
| 17 |
+
("test2.jsonl", 713377060, "095df7c5daf15f882c51a9deb84085cff1e073495a5dbcf95015a564d485f3a3"),
|
| 18 |
+
("test3.jsonl", 623360766, "28ed26cc83363ce3f1fe2d5fad9f8393077beb1907b167a31bd3b32f80801b79"),
|
| 19 |
+
("test4.jsonl", 1204644685, "d711138ddaebfcf5f8ec6a4283ee677298c0f5c5d374a235af92aaf0584510da"),
|
| 20 |
+
("test5.jsonl", 557699297, "7f77571c2a6df0c2a72a3277650309f67e01e0008e18117e624633df53f81214"),
|
| 21 |
+
("test6.jsonl", 134303240, "bb4c364f71921c4495a6ad15abe1a927350b720009f4933e2e71f8af0f6fd1f5"),
|
| 22 |
+
]
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
def sha256(path):
|
| 26 |
+
h = hashlib.sha256()
|
| 27 |
+
with path.open("rb") as stream:
|
| 28 |
+
for chunk in iter(lambda: stream.read(4 * 1024**2), b""):
|
| 29 |
+
h.update(chunk)
|
| 30 |
+
return h.hexdigest()
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
def download(opener, root, name, size, expected):
|
| 34 |
+
target = root / name
|
| 35 |
+
part = root / (name + ".part")
|
| 36 |
+
if target.is_symlink() or part.is_symlink():
|
| 37 |
+
raise ValueError("Symlink download destination refused")
|
| 38 |
+
if target.exists():
|
| 39 |
+
if target.stat().st_size != size or sha256(target) != expected:
|
| 40 |
+
raise ValueError(f"Existing {name} does not match pin; refusing overwrite")
|
| 41 |
+
print(f"REUSE_VERIFIED {name}", flush=True)
|
| 42 |
+
return
|
| 43 |
+
offset = part.stat().st_size if part.exists() else 0
|
| 44 |
+
if offset > size:
|
| 45 |
+
raise ValueError(f"Oversize partial file: {part}")
|
| 46 |
+
if offset < size:
|
| 47 |
+
req = urllib.request.Request(BASE + name, headers={"Range": f"bytes={offset}-"} if offset else {})
|
| 48 |
+
with opener.open(req, timeout=180) as response:
|
| 49 |
+
resumed = response.status == 206
|
| 50 |
+
if resumed and not response.headers.get("Content-Range", "").startswith(f"bytes {offset}-"):
|
| 51 |
+
raise ValueError("Range response offset mismatch")
|
| 52 |
+
if response.status not in (200, 206):
|
| 53 |
+
raise ValueError(f"Unexpected HTTP status {response.status}")
|
| 54 |
+
count = offset if resumed else 0
|
| 55 |
+
report_at = count + 64 * 1024**2
|
| 56 |
+
with part.open("ab" if resumed else "wb") as stream:
|
| 57 |
+
while chunk := response.read(4 * 1024**2):
|
| 58 |
+
count += len(chunk)
|
| 59 |
+
if count > size:
|
| 60 |
+
raise ValueError("Download exceeds pinned size")
|
| 61 |
+
stream.write(chunk)
|
| 62 |
+
if count >= report_at:
|
| 63 |
+
print(f"DOWNLOAD {name} {count}/{size}", flush=True)
|
| 64 |
+
report_at = count + 64 * 1024**2
|
| 65 |
+
if part.stat().st_size != size or sha256(part) != expected:
|
| 66 |
+
raise ValueError(f"Incomplete or corrupt {name}; partial kept for inspection")
|
| 67 |
+
part.rename(target)
|
| 68 |
+
print(f"VERIFIED {name}", flush=True)
|
| 69 |
+
|
| 70 |
+
|
| 71 |
+
def validate_row(row):
|
| 72 |
+
required = ("question_id", "question_content", "metadata", "starter_code", "public_test_cases", "private_test_cases")
|
| 73 |
+
if any(key not in row for key in required):
|
| 74 |
+
raise ValueError("Missing canonical LCB fields")
|
| 75 |
+
if not str(row["question_id"]) or not row["question_content"]:
|
| 76 |
+
raise ValueError("Empty ID/prompt")
|
| 77 |
+
metadata = json.loads(row["metadata"]) if isinstance(row["metadata"], str) else row["metadata"]
|
| 78 |
+
public = json.loads(row["public_test_cases"]) if isinstance(row["public_test_cases"], str) else row["public_test_cases"]
|
| 79 |
+
if not isinstance(metadata, dict) or not isinstance(public, list) or not row["private_test_cases"]:
|
| 80 |
+
raise ValueError("Invalid metadata/public/private tests")
|
| 81 |
+
types = {case["testtype"] for case in public}
|
| 82 |
+
if types - {"stdin", "functional"}:
|
| 83 |
+
raise ValueError("Unknown test type")
|
| 84 |
+
if "functional" in types and not metadata.get("func_name"):
|
| 85 |
+
raise ValueError("Functional task missing func_name")
|
| 86 |
+
return str(row["question_id"]), bool(metadata.get("func_name"))
|
| 87 |
+
|
| 88 |
+
|
| 89 |
+
def merge(root):
|
| 90 |
+
output = root / "problems.jsonl"
|
| 91 |
+
receipt = root / "manifest.json"
|
| 92 |
+
if output.exists() or receipt.exists():
|
| 93 |
+
if not output.is_file() or not receipt.is_file():
|
| 94 |
+
raise ValueError("Incomplete previous export; inspect before retry")
|
| 95 |
+
manifest = json.loads(receipt.read_text())
|
| 96 |
+
if manifest["revision"] != REVISION or manifest["sha256"] != sha256(output):
|
| 97 |
+
raise ValueError("Existing merged export mismatch")
|
| 98 |
+
return manifest
|
| 99 |
+
partial = root / "problems.jsonl.part"
|
| 100 |
+
if partial.is_symlink():
|
| 101 |
+
raise ValueError("Symlink output refused")
|
| 102 |
+
ids, functional, per_file = set(), 0, {}
|
| 103 |
+
h = hashlib.sha256()
|
| 104 |
+
with partial.open("wb") as dst:
|
| 105 |
+
for name, _, _ in SHARDS:
|
| 106 |
+
count = 0
|
| 107 |
+
with (root / name).open("rb") as src:
|
| 108 |
+
for line in src:
|
| 109 |
+
if not line.strip():
|
| 110 |
+
continue
|
| 111 |
+
row = json.loads(line)
|
| 112 |
+
identifier, is_functional = validate_row(row)
|
| 113 |
+
if identifier in ids:
|
| 114 |
+
raise ValueError(f"Duplicate question_id {identifier}")
|
| 115 |
+
ids.add(identifier)
|
| 116 |
+
functional += is_functional
|
| 117 |
+
count += 1
|
| 118 |
+
# Preserve every original field and its encoding, including starter_code and private tests.
|
| 119 |
+
line = line.rstrip(b"\r\n") + b"\n"
|
| 120 |
+
dst.write(line)
|
| 121 |
+
h.update(line)
|
| 122 |
+
per_file[name] = count
|
| 123 |
+
print(f"VALIDATED_ROWS {name} {count}", flush=True)
|
| 124 |
+
if len(ids) != 1055:
|
| 125 |
+
raise ValueError(f"Expected release_v6 1055 tasks; got {len(ids)}")
|
| 126 |
+
manifest = {"repo": "livecodebench/code_generation_lite", "revision": REVISION,
|
| 127 |
+
"release": "release_v6", "split": "test", "count": len(ids),
|
| 128 |
+
"functional_tasks": functional, "file": str(output), "sha256": h.hexdigest(),
|
| 129 |
+
"source_files": [{"name": n, "bytes": size, "sha256": sha, "rows": per_file[n]} for n, size, sha in SHARDS],
|
| 130 |
+
"validation": "source SHA256, IDs, count, required fields, public types and func_name; private payload preserved without execution/deserialization"}
|
| 131 |
+
partial.rename(output)
|
| 132 |
+
with receipt.open("x") as stream:
|
| 133 |
+
json.dump(manifest, stream, indent=2)
|
| 134 |
+
return manifest
|
| 135 |
+
|
| 136 |
+
|
| 137 |
+
def main():
|
| 138 |
+
p = argparse.ArgumentParser(description=__doc__)
|
| 139 |
+
p.add_argument("--output", type=Path, required=True)
|
| 140 |
+
p.add_argument("--proxy", required=True, help="Company-approved HTTP proxy")
|
| 141 |
+
args = p.parse_args()
|
| 142 |
+
root = args.output.resolve()
|
| 143 |
+
root.mkdir(parents=True, exist_ok=True)
|
| 144 |
+
# Keep one copy of raw shards plus one merged export. No data is deleted automatically.
|
| 145 |
+
remaining = sum(max(0, size - ((root/name).stat().st_size if (root/name).is_file() else
|
| 146 |
+
(root/(name+'.part')).stat().st_size if (root/(name+'.part')).is_file() else 0)) for name,size,_ in SHARDS)
|
| 147 |
+
if not (root/'problems.jsonl').exists():
|
| 148 |
+
remaining += sum(size for _,size,_ in SHARDS)
|
| 149 |
+
if shutil.disk_usage(root).free < remaining + 512 * 1024**2:
|
| 150 |
+
raise RuntimeError(f"Need approximately {remaining/1024**3:.2f} GiB plus 0.5 GiB reserve")
|
| 151 |
+
lock = root / '.download.lock'
|
| 152 |
+
with lock.open('x'):
|
| 153 |
+
pass
|
| 154 |
+
try:
|
| 155 |
+
# Explicit proxy only, normal TLS verification; no auth or policy bypass.
|
| 156 |
+
os.environ.pop('no_proxy', None)
|
| 157 |
+
os.environ.pop('NO_PROXY', None)
|
| 158 |
+
opener = urllib.request.build_opener(urllib.request.ProxyHandler({'http':args.proxy,'https':args.proxy}))
|
| 159 |
+
for shard in SHARDS:
|
| 160 |
+
download(opener, root, *shard)
|
| 161 |
+
manifest = merge(root)
|
| 162 |
+
print('LCB_V6_READY ' + json.dumps(manifest), flush=True)
|
| 163 |
+
finally:
|
| 164 |
+
lock.unlink()
|
| 165 |
+
|
| 166 |
+
|
| 167 |
+
if __name__ == '__main__':
|
| 168 |
+
main()
|
simct-b200-portable.bundle
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:68373987105b0533b4d346bd7155ee6edba7a5de596d52038372d2e0a28ecd1c
|
| 3 |
+
size 4024294
|
source-manifest.json
CHANGED
|
@@ -1,13 +1,17 @@
|
|
| 1 |
{
|
| 2 |
"source_branch": "vdt/ops/b200-portable",
|
| 3 |
-
"source_commit": "
|
| 4 |
"bundle_file": "simct-b200-portable.bundle",
|
| 5 |
-
"bundle_sha256": "
|
| 6 |
-
"bundle_bytes":
|
| 7 |
"history": "complete",
|
| 8 |
"format": "git-bundle",
|
| 9 |
"reason": "HF Git receive hook rejects historical PNG/JPG blobs; bundle preserves original Git object IDs",
|
| 10 |
"server_source_archive_sha256": "8bda6cea97d65395befa4b13d1e8a29a584db4a105ea9a68cb1740938de62bde",
|
| 11 |
"eval_archive_file": "simct-eval-94114c1.zip",
|
| 12 |
-
"eval_archive_sha256": "215aa548f4f6c303b19718717bc37dbd812aafc61551881a6105884e05bdfc51"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
}
|
|
|
|
| 1 |
{
|
| 2 |
"source_branch": "vdt/ops/b200-portable",
|
| 3 |
+
"source_commit": "323216b038b91f93fb5f311d953b52862939d4a3",
|
| 4 |
"bundle_file": "simct-b200-portable.bundle",
|
| 5 |
+
"bundle_sha256": "68373987105b0533b4d346bd7155ee6edba7a5de596d52038372d2e0a28ecd1c",
|
| 6 |
+
"bundle_bytes": 4024294,
|
| 7 |
"history": "complete",
|
| 8 |
"format": "git-bundle",
|
| 9 |
"reason": "HF Git receive hook rejects historical PNG/JPG blobs; bundle preserves original Git object IDs",
|
| 10 |
"server_source_archive_sha256": "8bda6cea97d65395befa4b13d1e8a29a584db4a105ea9a68cb1740938de62bde",
|
| 11 |
"eval_archive_file": "simct-eval-94114c1.zip",
|
| 12 |
+
"eval_archive_sha256": "215aa548f4f6c303b19718717bc37dbd812aafc61551881a6105884e05bdfc51",
|
| 13 |
+
"lcb_download_script": {
|
| 14 |
+
"file": "download_lcb_v6-323216b.py",
|
| 15 |
+
"sha256": "c61b681de9480f2a617cfcfd72e8b1459d6c9c976438587594946166239b8987"
|
| 16 |
+
}
|
| 17 |
}
|