igitagoz commited on
Commit
07dc2bf
Β·
1 Parent(s): fc014ea

Load Comfy-Org's pruned int8_convrot diffusion model (H3_DIFFUSION_MODEL switch)

Browse files
Files changed (2) hide show
  1. README.md +2 -1
  2. app.py +21 -3
README.md CHANGED
@@ -70,6 +70,7 @@ editing `app.py`.
70
  | `H3_PRELOAD_MODELS` | `1` | run the four loader nodes at startup so the GPU worker inherits the weights from the parent's RAM instead of reading ~34 GB from disk inside every job's GPU window |
71
  | `H3_GPU_RESIDENT` | `0` | also ask ComfyUI's model management to place the preloaded patchers on `cuda` at module level, so ZeroGPU restores them on allocation (the way the Wan Space's diffusers pipeline is loaded). Opt-in until it has been seen to work under the CUDA emulation; a failure falls back to the CPU preload |
72
  | `H3_SAGE_ATTENTION` | `0` | enable the SageAttention patch (INT8 quantised attention β€” faster, near-lossless, not bit-exact). Needs the `sageattention` wheel to import; the Space log says whether it did |
 
73
  | `MIN_GPU_SECONDS` / `MAX_GPU_SECONDS` | `60` / `1800` | clamp on the declared duration |
74
 
75
  Keyframes are scaled to the canvas with `lanczos` (upstream used `nearest-exact`,
@@ -85,7 +86,7 @@ When `job_id` is set and Space secret `HF_TOKEN` has write access, the finished
85
 
86
  | role | file | repo |
87
  |---|---|---|
88
- | diffusion model | `minimax_h3_fl2va_pruned_nvfp4.safetensors` (12.5 GB) | `lilcheaty/MiniMax-H3-NVFP4` |
89
  | text encoder | `qwen3vl_32b_minimax_h3_nvfp4_awq.safetensors` (15.7 GB) | `Comfy-Org/MiniMax-H3` |
90
  | video VAE | `minimax_h3_video_vae_fp16.safetensors` (5.2 GB) | `Comfy-Org/MiniMax-H3` |
91
  | audio VAE | `minimax_h3_audio_vae_fp32.safetensors` (0.6 GB) | `Comfy-Org/MiniMax-H3` |
 
70
  | `H3_PRELOAD_MODELS` | `1` | run the four loader nodes at startup so the GPU worker inherits the weights from the parent's RAM instead of reading ~34 GB from disk inside every job's GPU window |
71
  | `H3_GPU_RESIDENT` | `0` | also ask ComfyUI's model management to place the preloaded patchers on `cuda` at module level, so ZeroGPU restores them on allocation (the way the Wan Space's diffusers pipeline is loaded). Opt-in until it has been seen to work under the CUDA emulation; a failure falls back to the CPU preload |
72
  | `H3_SAGE_ATTENTION` | `0` | enable the SageAttention patch (INT8 quantised attention β€” faster, near-lossless, not bit-exact). Needs the `sageattention` wheel to import; the Space log says whether it did |
73
+ | `H3_DIFFUSION_MODEL` | `int8` | which conversion of the diffusion model to load β€” see *Models* |
74
  | `MIN_GPU_SECONDS` / `MAX_GPU_SECONDS` | `60` / `1800` | clamp on the declared duration |
75
 
76
  Keyframes are scaled to the canvas with `lanczos` (upstream used `nearest-exact`,
 
86
 
87
  | role | file | repo |
88
  |---|---|---|
89
+ | diffusion model | `minimax_h3_fl2va_pruned_int8_convrot.safetensors` (21 GB) β€” Comfy-Org's recommended I2V file; `H3_DIFFUSION_MODEL=fp8` β†’ `…pruned_fp8_scaled` (21 GB), `nvfp4` β†’ lilcheaty's `…pruned_nvfp4` (12.5 GB, the original choice: it lost prompt adherence against Wavespeed's open-weights H3 on 2026-10-16) | `Comfy-Org/MiniMax-H3` |
90
  | text encoder | `qwen3vl_32b_minimax_h3_nvfp4_awq.safetensors` (15.7 GB) | `Comfy-Org/MiniMax-H3` |
91
  | video VAE | `minimax_h3_video_vae_fp16.safetensors` (5.2 GB) | `Comfy-Org/MiniMax-H3` |
92
  | audio VAE | `minimax_h3_audio_vae_fp32.safetensors` (0.6 GB) | `Comfy-Org/MiniMax-H3` |
app.py CHANGED
@@ -37,10 +37,28 @@ COMFY_OUTPUT = COMFY / "output"
37
  # ComfyUI master on 2026-09-12; requirements.txt mirrors this commit's own pins.
38
  COMFYUI_COMMIT = os.environ.get("COMFYUI_COMMIT", "c75d8c966c29cb0392259af791f43373315b72db")
39
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  # (models/<subdir>, local filename, HF repo, path in repo)
41
  DOWNLOADS = [
42
- ("diffusion_models", "minimax_h3_fl2va_pruned_nvfp4.safetensors",
43
- "lilcheaty/MiniMax-H3-NVFP4", "minimax_h3_fl2va_pruned_nvfp4.safetensors"),
44
  ("text_encoders", "qwen3vl_32b_minimax_h3_nvfp4_awq.safetensors",
45
  "Comfy-Org/MiniMax-H3", "text_encoders/qwen3vl_32b_minimax_h3_nvfp4_awq.safetensors"),
46
  ("vae", "minimax_h3_video_vae_fp16.safetensors",
@@ -616,7 +634,7 @@ def generate_video(
616
 
617
  # ── Startup ──────────────────────────────────────────────────────────────────
618
 
619
- print("[setup] ComfyUI bootstrap", flush=True)
620
  ensure_comfy()
621
  ensure_models()
622
  init_comfy_nodes()
 
37
  # ComfyUI master on 2026-09-12; requirements.txt mirrors this commit's own pins.
38
  COMFYUI_COMMIT = os.environ.get("COMFYUI_COMMIT", "c75d8c966c29cb0392259af791f43373315b72db")
39
 
40
+ # Diffusion model conversion. The community NVFP4 file the Space started on lost prompt
41
+ # adherence against Wavespeed's open-weights H3 (same prompt, image and settings,
42
+ # 2026-10-16); Comfy-Org's own pruned int8_convrot is the file its I2V template
43
+ # recommends. "pruned" drops the precomputable AdaLN branches, not quality. The model
44
+ # card says to prefer int8_convrot where torch has cu130 and to use fp8_scaled only
45
+ # when it can't β€” switch with the Space variable H3_DIFFUSION_MODEL (int8 | fp8 | nvfp4).
46
+ DIFFUSION_MODELS = {
47
+ "int8": ("minimax_h3_fl2va_pruned_int8_convrot.safetensors",
48
+ "Comfy-Org/MiniMax-H3", "diffusion_models/minimax_h3_fl2va_pruned_int8_convrot.safetensors"),
49
+ "fp8": ("minimax_h3_fl2va_pruned_fp8_scaled.safetensors",
50
+ "Comfy-Org/MiniMax-H3", "diffusion_models/minimax_h3_fl2va_pruned_fp8_scaled.safetensors"),
51
+ "nvfp4": ("minimax_h3_fl2va_pruned_nvfp4.safetensors",
52
+ "lilcheaty/MiniMax-H3-NVFP4", "minimax_h3_fl2va_pruned_nvfp4.safetensors"),
53
+ }
54
+ DIFFUSION_MODEL = os.environ.get("H3_DIFFUSION_MODEL", "int8").strip().lower()
55
+ if DIFFUSION_MODEL not in DIFFUSION_MODELS:
56
+ print(f"[setup] unknown H3_DIFFUSION_MODEL={DIFFUSION_MODEL!r}, using int8", flush=True)
57
+ DIFFUSION_MODEL = "int8"
58
+
59
  # (models/<subdir>, local filename, HF repo, path in repo)
60
  DOWNLOADS = [
61
+ ("diffusion_models", *DIFFUSION_MODELS[DIFFUSION_MODEL]),
 
62
  ("text_encoders", "qwen3vl_32b_minimax_h3_nvfp4_awq.safetensors",
63
  "Comfy-Org/MiniMax-H3", "text_encoders/qwen3vl_32b_minimax_h3_nvfp4_awq.safetensors"),
64
  ("vae", "minimax_h3_video_vae_fp16.safetensors",
 
634
 
635
  # ── Startup ──────────────────────────────────────────────────────────────────
636
 
637
+ print(f"[setup] ComfyUI bootstrap β€” diffusion model {DIFFUSION_MODEL} ({UNET_NAME})", flush=True)
638
  ensure_comfy()
639
  ensure_models()
640
  init_comfy_nodes()