Download scripts/build_manifest.py from broduer/Jarvis: direct link, hf CLI and curl.
- Browser
- Download file 4.94 kB
-
https://huggingface.co/broduer/Jarvis/resolve/main/scripts/build_manifest.py
- Command line
-
hf download hf://broduer/Jarvis/scripts/build_manifest.py
-
curl -L -o build_manifest.py https://huggingface.co/broduer/Jarvis/resolve/main/scripts/build_manifest.py
4.94 kB
| #!/usr/bin/env python3 | |
| """Regenerate ``manifest.json`` and ``SHA256SUMS`` from the package tree. | |
| python scripts/build_manifest.py --version 1.1.0 | |
| The manifest is the machine-readable description of the bundle; SHA256SUMS is | |
| the flat file ``sha256sum -c`` can verify. Both are derived from what is on | |
| disk, so run this last, after building presets and samples. | |
| """ | |
| from __future__ import annotations | |
| import argparse | |
| import hashlib | |
| import json | |
| from datetime import datetime, timezone | |
| from pathlib import Path | |
| SKIP_DIRS = {"__pycache__", ".pytest_cache", ".git", "dist", "build"} | |
| SKIP_SUFFIXES = {".pyc", ".part", ".log"} | |
| # Derived from the tree, so hashing them would be circular. | |
| SKIP_FILES = {"manifest.json", "SHA256SUMS"} | |
| PRESETS = { | |
| "jarvis-prime": { | |
| "file": "voices/jarvis-prime.npy", | |
| "recipe": {"bm_lewis": 0.55, "bm_daniel": 0.30, "bm_george": 0.15}, | |
| "median_f0_hz": 105.3, | |
| "character": "default; lowest register with crisp consonants", | |
| }, | |
| "jarvis-classic": { | |
| "file": "voices/jarvis-classic.npy", | |
| "recipe": {"bm_george": 0.25, "bm_daniel": 0.35, "bm_lewis": 0.40}, | |
| "median_f0_hz": 114.0, | |
| "median_f1_hz": 589, | |
| "median_f2_hz": 1928, | |
| "character": "brighter, precise, unforced", | |
| }, | |
| "jarvis-deep": { | |
| "file": "voices/jarvis-deep.npy", | |
| "recipe": {"bm_lewis": 0.50, "bm_daniel": 0.50}, | |
| "median_f0_hz": 104.8, | |
| "median_f1_hz": 589, | |
| "median_f2_hz": 1810, | |
| "character": "heaviest; slower-feeling", | |
| }, | |
| } | |
| def digest(path: Path) -> tuple[int, str]: | |
| sha = hashlib.sha256() | |
| size = 0 | |
| with path.open("rb") as handle: | |
| for block in iter(lambda: handle.read(1024 * 1024), b""): | |
| sha.update(block) | |
| size += len(block) | |
| return size, sha.hexdigest() | |
| def iter_files(root: Path): | |
| for path in sorted(root.rglob("*")): | |
| if not path.is_file(): | |
| continue | |
| relative = path.relative_to(root) | |
| if relative.as_posix() in SKIP_FILES: | |
| continue | |
| if any(part in SKIP_DIRS for part in relative.parts[:-1]): | |
| continue | |
| if path.suffix.lower() in SKIP_SUFFIXES: | |
| continue | |
| yield relative | |
| def main() -> None: | |
| parser = argparse.ArgumentParser(description=__doc__) | |
| parser.add_argument("--version", default="1.1.0") | |
| parser.add_argument( | |
| "--created-at", | |
| default=datetime.now(timezone.utc).isoformat(timespec="seconds"), | |
| ) | |
| args = parser.parse_args() | |
| root = Path(__file__).resolve().parent.parent | |
| files: dict[str, dict[str, object]] = {} | |
| sums: list[str] = [] | |
| for relative in iter_files(root): | |
| size, sha = digest(root / relative) | |
| key = relative.as_posix() | |
| files[key] = {"bytes": size, "sha256": sha} | |
| sums.append(f"{sha} *{key}") | |
| (root / "SHA256SUMS").write_text( | |
| "\n".join(sums) + "\n", encoding="utf-8", newline="\n" | |
| ) | |
| manifest = { | |
| "schema_version": 1, | |
| "name": "Jarvis LVM", | |
| "version": args.version, | |
| "description": ( | |
| "Local, CPU-first JARVIS-inspired British butler voice built on " | |
| "Kokoro-82M, with a measured delivery planner." | |
| ), | |
| "license": "Apache-2.0", | |
| "created_at": args.created_at, | |
| "engine": { | |
| "package": "kokoro-onnx", | |
| "package_version": "0.6.1", | |
| "runtime": "onnxruntime", | |
| "provider": "CPUExecutionProvider", | |
| "model_format": "onnx-int8", | |
| "language": "en-gb", | |
| "sample_rate": 24000, | |
| }, | |
| "defaults": { | |
| "voice": "jarvis-prime", | |
| "speed": 0.95, | |
| "lang": "en-gb", | |
| "style": "jarvis", | |
| }, | |
| "delivery": { | |
| "style": "jarvis", | |
| "description": ( | |
| "Splits a reply at sentence and clause boundaries, inserts a " | |
| "measured pause (130 ms clause, 240 ms sentence), and slows " | |
| "the terminal clause. Set style='off' for plain delivery." | |
| ), | |
| "clause_gap_ms": 130, | |
| "sentence_gap_ms": 240, | |
| "segment_speeds": {"first": 0.99, "middle": 1.0, "last": 0.96}, | |
| }, | |
| "presets": PRESETS, | |
| "assets": { | |
| "model": "models/kokoro-v1.0.int8.onnx", | |
| "voices": "voices/voices-v1.0.bin", | |
| }, | |
| "performance": { | |
| "host": "Windows 11, 6 physical CPU cores, ONNX Runtime 1.32", | |
| "load_seconds": 0.77, | |
| "real_time_factor": 0.50, | |
| "rss_mib": 574, | |
| "intra_threads": 6, | |
| }, | |
| "files": files, | |
| } | |
| (root / "manifest.json").write_text( | |
| json.dumps(manifest, indent=2) + "\n", encoding="utf-8" | |
| ) | |
| print(f"wrote manifest.json and SHA256SUMS for {len(files)} files") | |
| if __name__ == "__main__": | |
| main() | |