Download runs/scripts/verify_dataset.py from BlueSourceJY/ERCBench-ShotStream-400: direct link, hf CLI and curl.
- Browser
- Download file 1.43 kB
-
https://huggingface.co/datasets/BlueSourceJY/ERCBench-ShotStream-400/resolve/main/runs/scripts/verify_dataset.py
- Command line
-
hf download hf://datasets/BlueSourceJY/ERCBench-ShotStream-400/runs/scripts/verify_dataset.py
-
curl -L -o verify_dataset.py https://huggingface.co/datasets/BlueSourceJY/ERCBench-ShotStream-400/resolve/main/runs/scripts/verify_dataset.py
1.43 kB
| import hashlib, json, os, sys | |
| root = sys.argv[1] | |
| m = json.load(open(os.path.join(root, "sha256.json"))) | |
| bad = [] | |
| for rel, h in m.items(): | |
| p = os.path.join(root, rel) | |
| if not os.path.isfile(p): bad.append((rel, "missing")); continue | |
| if hashlib.sha256(open(p, "rb").read()).hexdigest() != h: bad.append((rel, "mismatch")) | |
| allf = {os.path.relpath(os.path.join(d, f), root) for d, _, fs in os.walk(root) for f in fs} | |
| print("listed:", len(m), "bad:", len(bad), "unlisted files:", sorted(allf - set(m))) | |
| for b in bad[:20]: print(b) | |
| ids = [l.strip() for l in open(os.path.join(root, "priority_200.ids.txt")) if l.strip()] | |
| print("ids:", len(ids), "unique:", len(set(ids))) | |
| from collections import Counter | |
| cnt = Counter(); total = 0; pbad = [] | |
| for pr, eid in enumerate(ids, 1): | |
| ed = os.path.join(root, "episodes", eid) | |
| sm = json.load(open(os.path.join(ed, "shot_mapping.json"))) | |
| ss = json.load(open(os.path.join(ed, "story_script.json"))) | |
| shots = sm["shots"]; cnt[len(shots)] += 1 | |
| for s in shots: | |
| scenes = [sc for sc in ss["scenes"] if sc["scene_num"] == s["storymem_scene_num"]] | |
| assert len(scenes) == 1, (eid, s) | |
| p = scenes[0]["video_prompts"][s["storymem_shot_num"] - 1] | |
| total += 1 | |
| if hashlib.sha256(p.encode("utf-8")).hexdigest() != s["prompt_sha256"]: pbad.append((eid, s)) | |
| print("shot counts:", dict(cnt), "total shots:", total, "prompt mismatches:", len(pbad)) | |