Add minimax h3 mirror job script
Browse files- worker/minimax_mirror.py +46 -0
worker/minimax_mirror.py
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""One-shot job: mirror the int8 MiniMax H3 files from Comfy-Org/MiniMax-H3
|
| 2 |
+
into two compact repos (one per future serverless endpoint) so RunPod's
|
| 3 |
+
model-caching feature pulls ~54GB instead of the ~400GB full repo.
|
| 4 |
+
|
| 5 |
+
Runs on a throwaway RunPod CPU pod. Downloads one file at a time to keep
|
| 6 |
+
disk usage under the biggest single file (~27GB) + upload buffer.
|
| 7 |
+
"""
|
| 8 |
+
|
| 9 |
+
import os
|
| 10 |
+
import time
|
| 11 |
+
|
| 12 |
+
from huggingface_hub import HfApi, hf_hub_download
|
| 13 |
+
|
| 14 |
+
SRC = "Comfy-Org/MiniMax-H3"
|
| 15 |
+
SHARED = [
|
| 16 |
+
"text_encoders/qwen3vl_32b_minimax_h3_int8_convrot.safetensors",
|
| 17 |
+
"vae/minimax_h3_audio_vae_fp32.safetensors",
|
| 18 |
+
"vae/minimax_h3_video_vae_fp16.safetensors",
|
| 19 |
+
]
|
| 20 |
+
PLANS = {
|
| 21 |
+
"nikdevs/minimax-h3-fl2va": ["diffusion_models/minimax_h3_fl2va_pruned_int8_convrot.safetensors"] + SHARED,
|
| 22 |
+
"nikdevs/minimax-h3-ref2va": ["diffusion_models/minimax_h3_ref2va_pruned_int8_convrot.safetensors"] + SHARED,
|
| 23 |
+
}
|
| 24 |
+
WORK = "/workdir"
|
| 25 |
+
os.makedirs(WORK, exist_ok=True)
|
| 26 |
+
|
| 27 |
+
api = HfApi()
|
| 28 |
+
|
| 29 |
+
for repo, files in PLANS.items():
|
| 30 |
+
api.create_repo(repo, exist_ok=True, private=False)
|
| 31 |
+
existing = {s.rfilename for s in api.repo_info(repo).siblings}
|
| 32 |
+
for f in files:
|
| 33 |
+
if f in existing:
|
| 34 |
+
print(f"[skip] {repo} already has {f}", flush=True)
|
| 35 |
+
continue
|
| 36 |
+
t0 = time.time()
|
| 37 |
+
print(f"[dl] {SRC}/{f}", flush=True)
|
| 38 |
+
path = hf_hub_download(SRC, f, local_dir=WORK)
|
| 39 |
+
print(f"[dl] done in {time.time()-t0:.0f}s, uploading to {repo}", flush=True)
|
| 40 |
+
t0 = time.time()
|
| 41 |
+
api.upload_file(path_or_fileobj=path, path_in_repo=f, repo_id=repo)
|
| 42 |
+
print(f"[up] done in {time.time()-t0:.0f}s", flush=True)
|
| 43 |
+
os.remove(path)
|
| 44 |
+
|
| 45 |
+
print("MIRROR DONE", flush=True)
|
| 46 |
+
time.sleep(10 ** 6) # idle; the orchestrator terminates the pod
|