Download rebuild/vript.py from QLNI/shadow-assistant-data: direct link, hf CLI and curl.
- Browser
- Download file 1.02 kB
-
https://huggingface.co/datasets/QLNI/shadow-assistant-data/resolve/main/rebuild/vript.py
- Command line
-
hf download hf://datasets/QLNI/shadow-assistant-data/rebuild/vript.py
-
curl -L -o vript.py https://huggingface.co/datasets/QLNI/shadow-assistant-data/resolve/main/rebuild/vript.py
1.02 kB
| """Vript (academic research only), as SHADOW picture codes. | |
| python vript.py eye_int8.safetensors shadow_table_v1.npz out/ | |
| """ | |
| import json, os, sys | |
| from huggingface_hub import HfApi, hf_hub_download | |
| from video_codes import Eye, Shards, encode_archive, stem | |
| R = "Mutonix/Vript" | |
| eye, out = Eye(sys.argv[1], sys.argv[2]), Shards(sys.argv[3], "vript") | |
| ann = {} | |
| for f in ("vript_captions/vript_long_videos_captions.jsonl", "vript_captions/vript_short_videos_captions.jsonl"): | |
| for line in open(hf_hub_download(R, f, repo_type="dataset"), encoding="utf-8"): | |
| if line.strip(): | |
| r = json.loads(line) | |
| ann.setdefault(r.get("clip_id"), []).append(r) | |
| for f in sorted(f for f in HfApi().list_repo_files(R, repo_type="dataset") | |
| if f.startswith(("vript_long_videos_clips/", "vript_short_videos_clips/")) and f.endswith(".zip")): | |
| p = hf_hub_download(R, f, repo_type="dataset") | |
| encode_archive(eye, out, p, ann, stem, "vript", {"repo": R, "file": f}) | |
| os.remove(p) | |
| out.write() | |