Weights and checkpoints
Verity never commits binary model checkpoints to git and never bakes gigabytes of weights into its PyInstaller executable or :slim container image. Instead, detectors/weights_manifest.yaml acts as the single authoritative inventory for every checkpoint — recording origin URL, byte size, SHA-256 checksum, upstream copyright/citation, license terms, and whether Verity is permitted to re-host a mirror copy.
Design principles & engineering rationale
- Verify everything before execution. A silent weight substitution or truncated download would invalidate an evidence pipeline.
_fetch_file(src/verity/weights/fetch.py) streams every download to a.partfile, verifies exact byte size and SHA-256 hash against the manifest, deletes any mismatch immediately, and only renames on verification pass. - Respect upstream authorship and licenses. Re-hosting checkpoints without clear redistribution permission risks legal violations and misattribution. Every file defaults strictly to author attribution in both
NOTICE.mdandADPer/verity-weights(README.mdexplicitly states that Verity mirrors upstream work for reproducible lab provisioning and trained none of the weights). Files withredistributable: falseare never copied byverity weights bundleand always fetch solely from upstream origin URLs. - Zero duplication via hard-links. Shared checkpoints (such as
I3D_8x8_R50.pthused acrossi3dandaltfreezing) are downloaded once and hard-linked (os.link, falling back toshutil.copy2across filesystems). - Upgrade-safe persistence. In standalone binary (
platformdirs) and Docker setups,detectors/<id>/weightsis a symlink to<weights_root>/<id>, ensuring binary upgrades or detector script refreshes never delete verified multi-gigabyte checkpoints.
Version-2 manifest architecture (src/verity/weights/manifest.py)
load_manifest() enforces version >= 2 and parses seven sections from detectors/weights_manifest.yaml:
| Section | Purpose |
|---|---|
hub | Mirror configuration (huggingface_repo: "ADPer/verity-weights", revision: main, overridable by VERITY_WEIGHTS_HUB) |
licenses | Canonical license ID -> URL map |
sources | Upstream attribution blocks (name, url, license, copyright, citation, note) |
files | Per-file sha256, size, source, origin, redistributable, optional hub_path, license override, and archive member extraction spec |
detectors | Per-detector target mapping (string or {file, dest}) under detectors/<id>/weights/ |
runtime_fetched | Documentation & license tracking for Hugging Face / Torch Hub / FAN models pulled at first run (clip, gend, univfd, antideepfake_mms, aeroblade, realforensics, etc.) |
no_checkpoint | Explicit record of architectures shipped with random initialization |
For archive-hosted releases whose server-generated zip bytes vary on the fly (for example LAA-Net's Dropbox folder download), FileSpec.archive treats the outer zip checksum as advisory and verifies the extracted inner member's exact size and SHA-256 before acceptance.
Mirroring & licensing policy (ADPer/verity-weights)
detectors/weights_manifest.yaml configures ADPer/verity-weights as the mirror for the 28 redistributable files (6.32 GB):
| Checkpoint group | License | Mirror policy |
|---|---|---|
DeepfakeBench FF++ c23 detectors (xception, efficientnetb4, f3net, spsl, srm, ffd, core, ucf, recce, capsule_net, meso4, meso4Inception, resnet34) & I3D_8x8_R50 | CC-BY-NC-4.0 | Mirrored (ADPer/verity-weights) |
Backbones (hrnetv2_w48, xception-b5690688) | MIT / BSD-3-Clause | Mirrored |
aasist, rawnet2, lipforensics, realforensics, syncnet, univfd, community_forensics, m2tr, vlaforge, m2f2_det, safe | MIT / Apache-2.0 | Mirrored |
forensics_adapter | CC-BY-NC-4.0 | Mirrored (embeds frozen MIT CLIP) |
11 origin-only files: NPR (npr), MLEP (mlep), FTCN (ftcn), D³ (d3), ProDet (prodet), LipFD (lipfd), XLS-R+SLS (xlsr_sls), DF40 (df40_clip), Effort (effort), SBI (sbi), LAA-Net (laa_net) | none-stated, SBI-academic, SnT-academic, or origin-only CC-BY-NC-4.0 | Never mirrored — fetched strictly from upstream Drive / GitHub / Dropbox / HF author URLs |
Note that FileSpec.effective_license() applies file-level license overrides cleanly whenever an upstream repository's release metadata differs from its model card (xlsr-sls.onnx). Manifest.hub_url() returns None for any redistributable: false file, guaranteeing origin-only enforcement even with --source hub.
CLI commands (verity weights ...)
verity weights pull [--trained | --all | --detector a,b] [--source auto|hub|origin] [--force]— downloads using hub-first order (forredistributable: true), falls back toorigin, skips verified files, replaces corrupt local files, and hard-links twins.verity weights warmup [--trained | --all | --detector a,b] [--profile auto|cuda|cpu]— invokesenv_manager.warmup_detectorsto execute each runtime-fetched model'sbuild_model()once on CPU so Hugging Face / Torch Hub / FAN weights land in persistent<cache_dir>/huggingfaceand<cache_dir>/torchbefore disconnecting from the internet.verity weights status [--verify]/verity weights verify— reportsmissing,present,verified, orCORRUPT, exiting non-zero on corruption.verity weights bundle --repo ADPer/verity-weights --out dist-weights(src/verity/weights/bundle.py) — offline assembler that links onlyredistributable: trueverified files, generates a full model card (README.md) explicitly crediting all upstream projects and noting excluded origin-only repos, writesNOTICE.md,LICENSE,manifest.json,sha256sums.txt, and an LFS.gitattributescovering*.pth,*.pt,*.safetensors,*.onnx,*.model,*.tar, and*.bin.
Air-gap & container behavior
- Standalone binary:
verity setup --trained --airgap-readycombinespullwarmup+verifyand sealsoffline: truein<config_dir>/config.yaml.verity airgap exportpackagesweights/alongsidecache-models.tar.gz(HF + Torch Hub caches) for physical media transfer.
- Docker:
docker/entrypoint.shchecksVERITY_WEIGHTS_AUTO=1(unlessVERITY_OFFLINE=1) to pull missing trained checkpoints into/weightsbefore startingserveror analysis commands.
Related pages
- Detector runtime and isolation —
warmup_detectorsand offline environment variables. - Detector selection and trust tiers — offline weight gating.
- Deployment, configuration and air-gap operations —
airgap export/import. - Releasing, publishing and extending Verity — publishing checkpoints to
ADPer/verity-weights.