Datasets:
Download scripts/check_hosted_artifact.py from Salesforce/BehaviorBench: direct link, hf CLI and curl.
- Browser
- Download file 1.22 kB
-
https://huggingface.co/datasets/Salesforce/BehaviorBench/resolve/main/scripts/check_hosted_artifact.py
- Command line
-
hf download hf://datasets/Salesforce/BehaviorBench/scripts/check_hosted_artifact.py
-
curl -L -o check_hosted_artifact.py https://huggingface.co/datasets/Salesforce/BehaviorBench/resolve/main/scripts/check_hosted_artifact.py
1.22 kB
| #!/usr/bin/env python3 | |
| """Verify the final Salesforce/BehaviorBench hosted paths after upload.""" | |
| import json, sys | |
| from pathlib import Path | |
| import requests | |
| ROOT=Path(__file__).resolve().parents[1] | |
| meta=json.loads((ROOT/"croissant.json").read_text()) | |
| errors=[] | |
| page="https://huggingface.co/datasets/Salesforce/BehaviorBench" | |
| r=requests.get(page,timeout=30) | |
| if r.status_code!=200: errors.append(f"dataset page HTTP {r.status_code}: {page}") | |
| for i,d in enumerate(meta["distribution"],1): | |
| url=d["contentUrl"] | |
| try: | |
| r=requests.get(url,headers={"Range":"bytes=0-31"},stream=True,timeout=60,allow_redirects=True) | |
| first=next(r.iter_content(64),b"") | |
| if r.status_code not in (200,206): errors.append(f"HTTP {r.status_code}: {url}") | |
| elif first.startswith(b"version https://git-lfs.github.com/spec"): | |
| errors.append(f"unresolved LFS pointer: {url}") | |
| except Exception as e: errors.append(f"{url}: {e}") | |
| print(f"[{i}/{len(meta['distribution'])}] {d['@id']}") | |
| if errors: | |
| print("FAIL",file=sys.stderr) | |
| print("\n".join(f"- {x}" for x in errors),file=sys.stderr);sys.exit(1) | |
| print(f"PASS: dataset page and all {len(meta['distribution'])} Croissant files are accessible.") | |