download.py 2.06 KB
"""Pre-download MiniMax-H3 NF4 weights via DiffSynth's own ModelConfig,
so the on-disk layout matches exactly what the pipeline later resolves.

已下过的会被 download_if_necessary() 跳过,重跑是幂等的。
两个分区:FL2VA 收首末帧,Ref2VA 收任意多张参考图/参考视频,
DiT 与 processor 各一套,VAE 和文本编码器共用。"""
import os, time, traceback
from diffsynth.core.loader import ModelConfig

JOBS = [  # small first, so a load smoke-test can start early
    ("MiniMax/MiniMax-H3",              "FL2VA/processor/"),
    ("DiffSynth-Studio/MiniMax-H3-NF4", "audio_vae_nf4.safetensors"),
    ("DiffSynth-Studio/MiniMax-H3-NF4", "video_vae_nf4.safetensors"),
    ("lightx2v/Minimax-h3-Turbo",       "minimax_h3_fl2v_turbo_4step_v1.0_768p_bf16.safetensors"),
    ("DiffSynth-Studio/MiniMax-H3-NF4", "minimax-h3-text-encoder-nf4.safetensors"),
    ("DiffSynth-Studio/MiniMax-H3-NF4", "minimax-h3-fl2va-nf4.safetensors"),
    # Ref2VA:参考图模式。Turbo LoRA 只有 v0.1,FL2V 那个是 v1.0 768p。
    ("MiniMax/MiniMax-H3",              "Ref2VA/processor/"),
    ("lightx2v/Minimax-h3-Turbo",       "minimax_h3_ref2v_turbo_4step_v0.1_bf16.safetensors"),
    ("DiffSynth-Studio/MiniMax-H3-NF4", "minimax-h3-ref2va-nf4.safetensors"),
    # 上面那个 bf16 版实测出噪点(二分见 docs/H3)。comfyui 版是另一套键名,试它能不能被认。
    ("lightx2v/Minimax-h3-Turbo",       "minimax_h3_ref2v_turbo_4step_v0.1_comfyui_bf16.safetensors"),
]

for i, (mid, pat) in enumerate(JOBS, 1):
    t0 = time.time()
    print(f"[{i}/{len(JOBS)}] {mid} :: {pat}", flush=True)
    for attempt in range(1, 6):
        try:
            ModelConfig(model_id=mid, origin_file_pattern=pat).download_if_necessary()
            print(f"    done in {time.time()-t0:.0f}s", flush=True)
            break
        except Exception:
            print(f"    attempt {attempt} failed:\n{traceback.format_exc()}", flush=True)
            time.sleep(15)
    else:
        print(f"    GIVING UP on {mid}::{pat}", flush=True)
print("ALL DOWNLOADS FINISHED", flush=True)