Run this model with HF Jobs

Run Agnes-AI/Agnes-Video-H3-MoE on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs to fine-tune https://huggingface.co/Agnes-AI/Agnes-Video-H3-MoE. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/Agnes-AI/Agnes-Video-H3-MoE on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
File size: 2,467 Bytes
2594d73
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
"""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())