#!/usr/bin/env python3 """ Verify safetensors file integrity: header matches actual data offsets. Used for diagnosing 'Error while deserializing header: incomplete metadata' even when file size looks correct. Usage from Proxmox host (remote ComfyUI in LXC): ssh root@10.0.20.91 'bash -s' < scripts/check_safetensors.py """ import struct, json, os, sys def check(path): if not os.path.exists(path): print(f"MISSING: {path}") return False try: with open(path, "rb") as f: hlen = struct.unpack("