Download deploy/check.py from Agnes-AI/Agnes-Video-H3-MoE: direct link, hf CLI and curl.
- Browser
- Download file 2.47 kB
-
https://huggingface.co/Agnes-AI/Agnes-Video-H3-MoE/resolve/main/deploy/check.py
- Command line
-
hf download hf://Agnes-AI/Agnes-Video-H3-MoE/deploy/check.py
-
curl -L -o check.py https://huggingface.co/Agnes-AI/Agnes-Video-H3-MoE/resolve/main/deploy/check.py
2.47 kB
| """Confirm the handoff files and that Python imports the bundled DiffSynth snapshot. | |
| Does not load the FL2VA weights and does not use a GPU. | |
| """ | |
| from __future__ import annotations | |
| import hashlib | |
| import json | |
| import sys | |
| from pathlib import Path | |
| DEPLOY = Path(__file__).resolve().parent | |
| PACKAGE = DEPLOY.parent | |
| def sha256(path: Path) -> str: | |
| digest = hashlib.sha256() | |
| with path.open("rb") as handle: | |
| for chunk in iter(lambda: handle.read(1024 * 1024), b""): | |
| digest.update(chunk) | |
| return digest.hexdigest() | |
| def check_sums(root: Path, sums_file: Path) -> list[str]: | |
| errors = [] | |
| for line in sums_file.read_text().splitlines(): | |
| line = line.strip() | |
| if not line: | |
| continue | |
| digest, rel = line.split(None, 1) | |
| path = root / rel | |
| if not path.is_file(): | |
| errors.append(f"missing {path}") | |
| continue | |
| got = sha256(path) | |
| if got != digest: | |
| errors.append(f"hash mismatch {rel}: {got}") | |
| return errors | |
| def main() -> int: | |
| errors = [] | |
| manifest = json.loads((PACKAGE / "manifest.json").read_text()) | |
| for name, spec in manifest["weights"].items(): | |
| path = PACKAGE / name | |
| if not path.is_file(): | |
| errors.append(f"missing {path}") | |
| continue | |
| if path.stat().st_size != spec["bytes"]: | |
| errors.append(f"size mismatch {name}: {path.stat().st_size}") | |
| got = sha256(path) | |
| if got != spec["sha256"]: | |
| errors.append(f"hash mismatch {name}: {got}") | |
| fl2va = PACKAGE / "FL2VA" | |
| for rel in ( | |
| "transformer", | |
| "text_encoder", | |
| "video_vae/source/model.safetensors", | |
| "audio_vae/model.safetensors", | |
| "processor", | |
| ): | |
| if not (fl2va / rel).exists(): | |
| errors.append(f"missing FL2VA/{rel}") | |
| errors.extend(check_sums(DEPLOY, DEPLOY / "SHA256SUMS")) | |
| sys.path.insert(0, str(DEPLOY / "code")) | |
| sys.path.insert(0, str(DEPLOY)) | |
| from load import assert_snapshot_dit | |
| dit_file = assert_snapshot_dit() | |
| from shared_moe import SharedE8T1MLP | |
| if SharedE8T1MLP is None: | |
| errors.append("snapshot modules did not import") | |
| if errors: | |
| print("\n".join(errors)) | |
| return 1 | |
| print(f"weights ok: {', '.join(manifest['weights'])}") | |
| print(f"code ok: {dit_file}") | |
| print("import ok: SharedE8T1MLP") | |
| return 0 | |
| if __name__ == "__main__": | |
| raise SystemExit(main()) | |