Files
neuron-tai/scripts/provision_split_gguf.py
Dobromir Popov 966aa10854 distributed-gguf-runtime: add CMake skeleton, gRPC harness, split-GGUF provisioning, performance contracts
DGR-019  Lock alpha/beta performance contracts (evidence + contract framework)
DGR-020  Run controlled whole-model GGUF baseline (benchmark results & contracts)
DGR-024  Real generated-gRPC protocol harness (shard_runtime_server.py + tests)
DGR-026  split-GGUF provisioning outside /home (provision script + manifest + tests)
DGR-028  Numbered patch-stack apply & verify (llama_cpp_dependency.py + UPSTREAM_LOCK.json)
DGR-029  Native CMake skeleton + deterministic CPU lane (UPSTREAM_LOCK.json + cmake gating)

New modules:
  packages/node/meshnet_node/dgr_performance/  — performance contract framework
  packages/node/meshnet_node/split_gguf/        — split-GGUF manifest & provisioning
  scripts/provision_split_gguf.py               — artifact provisioning CLI
  tests/test_dgr_performance_contract.py        — contract validation tests
  tests/test_split_gguf_manifest.py             — manifest tests
  tests/test_split_gguf_provision.py            — provisioning tests
  tests/test_shard_runtime_harness.py           — gRPC harness tests
2026-07-23 09:55:00 +03:00

78 lines
2.6 KiB
Python

#!/usr/bin/env python3
"""Provision exact split-GGUF artifacts to mounted-drive storage (DGR-026).
Reads a split-artifact manifest (`meshnet_node.split_gguf.manifest`),
resumably fetches every split it declares — by default from the split's
manifest `url` over HTTP(S), or from a local directory with `--source-dir`
for splits already staged/mirrored elsewhere — verifies each split's SHA-256
against the manifest, and refuses to write under `/home`.
This tool never invents a quantization, split count, or layer layout: it only
executes whatever the manifest declares. It is opt-in and network-using; the
default test suite never calls it.
"""
from __future__ import annotations
import argparse
import pathlib
import sys
ROOT = pathlib.Path(__file__).resolve().parents[1]
sys.path.insert(0, str(ROOT / "packages/node"))
from meshnet_node.split_gguf.manifest import ( # noqa: E402
SplitArtifactManifestError,
load_split_artifact_manifest,
)
from meshnet_node.split_gguf.provision import ( # noqa: E402
SplitProvisionError,
http_split_fetcher,
local_directory_fetcher,
provision_split_artifact,
)
def main(argv: list[str] | None = None) -> int:
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--manifest", required=True, type=pathlib.Path, help="split-artifact manifest JSON")
parser.add_argument("--dest", required=True, type=pathlib.Path, help="mounted-drive destination directory")
parser.add_argument(
"--source-dir",
type=pathlib.Path,
default=None,
help="copy splits from this local directory instead of downloading each split's manifest url",
)
args = parser.parse_args(argv)
try:
manifest = load_split_artifact_manifest(args.manifest)
except SplitArtifactManifestError as exc:
print(f"error: {exc}", file=sys.stderr)
return 2
if args.source_dir is not None:
fetch = local_directory_fetcher(args.source_dir)
else:
missing_urls = [split.name for split in manifest.splits if not split.url]
if missing_urls:
print(
f"error: manifest splits missing a url and no --source-dir given: {missing_urls}",
file=sys.stderr,
)
return 2
fetch = http_split_fetcher(lambda split: split.url)
try:
result = provision_split_artifact(manifest, args.dest, fetch)
except SplitProvisionError as exc:
print(f"error: {exc}", file=sys.stderr)
return 1
print(f"provisioned {len(result.verified_splits)} split(s) to {result.dest_dir}")
return 0
if __name__ == "__main__":
raise SystemExit(main())