"""Verify every downloaded weight: exact byte size vs ModelScope, and a safetensors header parse.""" import os, sys, json, struct, urllib.request BASE = os.environ.get("DIFFSYNTH_MODEL_BASE_PATH", "/data/models/minimax-h3/models") WANT = { "DiffSynth-Studio/MiniMax-H3-NF4": ["minimax-h3-fl2va-nf4.safetensors", "minimax-h3-ref2va-nf4.safetensors", "minimax-h3-text-encoder-nf4.safetensors", "video_vae_nf4.safetensors", "audio_vae_nf4.safetensors"], "lightx2v/Minimax-h3-Turbo": ["minimax_h3_fl2v_turbo_4step_v1.0_768p_bf16.safetensors", "minimax_h3_ref2v_turbo_4step_v0.1_bf16.safetensors"], } PROCESSORS = ["MiniMax/MiniMax-H3/FL2VA/processor", "MiniMax/MiniMax-H3/Ref2VA/processor"] def remote_sizes(mid): u = f"https://www.modelscope.cn/api/v1/models/{mid}/repo/files?Recursive=true" d = json.load(urllib.request.urlopen(u, timeout=60)) return {f["Path"]: f.get("Size", 0) for f in d.get("Data", {}).get("Files", []) if f.get("Type") == "blob"} def header_ok(path): with open(path, "rb") as f: n = struct.unpack("