Download code_and_checkpoints/release_metadata/verify_release.py from panxy1019/RAL-MoE-ROM: direct link, hf CLI and curl.
- Browser
- Download file 1.44 kB
-
https://huggingface.co/datasets/panxy1019/RAL-MoE-ROM/resolve/main/code_and_checkpoints/release_metadata/verify_release.py
- Command line
-
hf download hf://datasets/panxy1019/RAL-MoE-ROM/code_and_checkpoints/release_metadata/verify_release.py
-
curl -L -o verify_release.py https://huggingface.co/datasets/panxy1019/RAL-MoE-ROM/resolve/main/code_and_checkpoints/release_metadata/verify_release.py
1.44 kB
| """Verify the payload manifest using only the Python standard library.""" | |
| import argparse | |
| import csv | |
| import hashlib | |
| from pathlib import Path | |
| def main(): | |
| parser = argparse.ArgumentParser() | |
| parser.add_argument("--release-root", type=Path, default=Path(__file__).resolve().parents[2]) | |
| parser.add_argument("--sizes-only", action="store_true") | |
| args = parser.parse_args() | |
| root = args.release_root.resolve(strict=True) | |
| manifest = root / "code_and_checkpoints/release_metadata/FILE_MANIFEST.csv" | |
| count = 0 | |
| total = 0 | |
| with manifest.open(encoding="utf-8", newline="") as stream: | |
| for row in csv.DictReader(stream): | |
| path = root / row["destination_relative_path"] | |
| assert path.resolve(strict=True).is_relative_to(root), path | |
| assert path.is_file() and not path.is_symlink(), path | |
| assert path.stat().st_size == int(row["bytes"]), path | |
| if not args.sizes_only: | |
| with path.open("rb") as source: | |
| actual = hashlib.file_digest(source, "sha256").hexdigest() | |
| assert actual == row["sha256"], path | |
| count += 1 | |
| total += int(row["bytes"]) | |
| if count % 5000 == 0: | |
| print(f"Verified {count} payload files", flush=True) | |
| print(f"VERIFIED files={count} logical_GiB={total / 2**30:.2f} hash_checked={not args.sizes_only}") | |
| if __name__ == "__main__": | |
| main() | |