Update app.py
Browse files1234567891071 unmodified lines8283848586878834 unmodified lines1231241251261271281298 unmodified lines138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168131 unmodified lines300301302303304305306195 unmodified lines5025035045055065075085095105115125135145155165175185195202 unmodified lines523524525526527528529122 unmodified lines6526536546556566576585 unmodified lines6646656666676686696706716726736746756766 unmodified lines683684685686"""`Plaguekind/Minimax-H3` — the PlagueKind V1.5 ComfyUI workflow for MiniMax-H3, as a Space.The candidate repository holds no weights: it is a ComfyUI graph over `Comfy-Org/MiniMax-H3`, so what isreproduced here is the *graph*, on the `MiniMaxAI/MiniMax-H3` diffusers checkpoint. See `pk_workflow.py` for thenode-by-node mapping; the short version is euler + `linear_quadratic` at 15 steps, FSR RCAS sharpening at 0.3, andFILM 2x frame interpolation to 48 fps.Deployment is the split one the unquantized MiniMax-H3 needs: 195.9 GiB of bfloat16 does not fit under a Space's150 GB storage quota, so the 62.14 GiB Qwen3-VL text encoder runs in a separate Space(`multimodalart/qwen3vl-conditioner`) that this one calls per request, and this Space holds the 61.73 GiB71 unmodified linesdef snap_frames(seconds: float) -> int:"""The frame count MiniMax-H3's video VAE can decode: the next `17 * n + 5` at 24 fps.Identical to the workflow's `ComfyMathExpression`,`max(5, round(a*24)) + (5 - (max(5, round(a*24)) % 17)) % 17` — 5 s is 124 frames, i.e. 5.167 s."""34 unmodified linesdef load_models() -> str | None:"""Load the denoising half at startup, plus FILM.`MiniMaxH3GeneratorBlocks` declares `transformer`, `vae`, `audio_vae`, the two schedulers and `video_processor`,so `load_components` fetches exactly those subfolders — `text_encoder/` and `transformer_ref/` are nevertouched. Both autoencoders carry `_keep_in_fp32_modules` over every module and stay float32: a bfloat16 audio8 unmodified linestry:import torchfrom diffusers import ComponentsManagerfrom h3_split_blocks import MiniMaxH3GeneratorBlockslower_duration_floor()manager = ComponentsManager()blocks = MiniMaxH3GeneratorBlocks()print(f"[gen] loading {[c.name for c in blocks.expected_components]} from {MODEL_REPO} ...",flush=True,)pipe = blocks.init_pipeline(MODEL_REPO,components_manager=manager,collection="h3",)pipe.load_components(dtype=torch.bfloat16)# Load TenStrip fine-tuned checkpoint into the transformerfrom huggingface_hub import hf_hub_downloadfrom safetensors.torch import load_modelfinetune_path = hf_hub_download(repo_id="TenStrip/10Eros-Max", filename="10Eros_Max_h3_fl2va_bf16_test2_pruned.safetensors")load_model(pipe.transformer, finetune_path, strict=False, device="cpu")pipe.transformer.to(torch.bfloat16)pipe.transformer.set_attention_backend(ATTENTION)# Still startup, still free: an AoTI package carries no weights and opens its archive lazily inside the GPU131 unmodified linesseed,):"""The only thing on GPU time: the denoise loop, the two decoders and the workflow's post chain.The mp4 is muxed here rather than in the caller: a `@spaces.GPU` return crosses a process boundary by pickling,and a 2x-interpolated 124-frame clip is several hundred MB of frames against a few MB of h264."""195 unmodified linesload_models()INTRO = """# PlagueKind · 10Eros-Max · MiniMax-H3<div align="center"><a href="https://huggingface.co/Plaguekind/Minimax-H3" target="_blank" rel="noopener"><strong>[ workflow ]</strong></a> <a href="https://huggingface.co/MiniMaxAI/MiniMax-H3" target="_blank" rel="noopener"><strong>[ model ]</strong></a> <a href="https://github.com/PlagueKind/Comfyui-PlagueKind-Nodes" target="_blank" rel="noopener"><strong>[ nodes ]</strong></a><a href="https://huggingface.co/TenStrip/10Eros-Max" target="_blank" rel="noopener"><strong>[ 10Eros-Max ]</strong></a></div>**MiniMax-H3** is a 33B parameter video generation model that produces video and a fully synchronized soundtrack(ambience, foley, speech) in one pass. **PlagueKind's V1.5 workflow** is a tuning of it: euler on a`linear_quadratic` sigma grid at 15 steps, FSR **RCAS** sharpening at 0.3, and **FILM** 2x frame interpolation to48 fps. Text-to-video, first frame, last frame, or both. TenStrip's **10Eros-Max** is an experimental finetune of MiniMax-H3."""CSS = """2 unmodified lines.status p {font-size: 0.8rem; opacity: 0.65; text-align: center;}"""with gr.Blocks(title="PlagueKind · 10Eros-Max · MiniMax-H3") as demo:gr.Markdown(INTRO)gr.Markdown(status(), elem_classes="status")122 unmodified lines"""`Plaguekind/Minimax-H3` ships no weights — it is a ComfyUI graph over `Comfy-Org/MiniMax-H3`. Its nodes map ontothis Space as:| ComfyUI node | widget | here ||---|---|---|| `KSamplerSelect` | `euler` | MiniMax-H3's only sampler; the checkpoint is CFG-distilled, so one forward per step and no negative prompt |5 unmodified lines| `CreateVideo` | fps `24 * 2` | 48 fps output || `RTXVideoSuperResolution` | 2x `ULTRA` | **not reproduced** || `PathchSageAttentionKJ` | `sageattn_qk_int8_pv_fp8_cuda++` | cuDNN fused attention |Two deliberate deviations. `RTXVideoSuperResolution` is NVIDIA's NGX super-resolution, shipped as a driver-levelWindows/RTX component with no Linux Python path, so the 2x upscale is missing — pick a larger **Target dimension**instead of upscaling a small one. And SageAttention's `qk_int8_pv_fp8_cuda++` kernel is not built for this pool'ssm120 cards, so attention runs cuDNN's fused kernel, which is the fastest available here and is numerically thefaithful one (SageAttention is a quantized approximation).One upgrade: the workflow loads `minimax_h3_fl2va_pruned_int8_convrot.safetensors` and a`qwen3vl_32b_..._int8_convrot` text encoder because that is what fits a consumer card. This Space runs both**unquantized bfloat16**, off `MiniMaxAI/MiniMax-H3`, with the 62 GiB text encoder in a6 unmodified linesif __name__ == "__main__":# `theme` and `css` belong to `launch()` from Gradio 6.0 on; on `Blocks` they warn and are ignored.demo.launch(show_error=True, theme=gr.themes.Citrus(), css=CSS)1234567871 unmodified lines80818283848534 unmodified lines1201211221231241258 unmodified lines134135136137138139140141142143144145146147148131 unmodified lines280281282283284285195 unmodified lines4814824834844854864874884894904914924934944954962 unmodified lines499500501502503504505122 unmodified lines6286296306316326335 unmodified lines6396406416426436446456466476486496 unmodified lines656657658659"""`Plaguekind/Minimax-H3` — the PlagueKind V1.5 ComfyUI workflow for MiniMax-H3, as a Space.The candidate repository holds no weights: it is a ComfyUI graph over `Comfy-Org/MiniMax-H3`, so what isreproduced here is the *graph*, on the `MiniMaxAI/MiniMax-H3` diffusers checkpoint. See `pk_workflow.py` for thenode-by-node mapping; the short version is euler + `linear_quadratic` at 15 steps, FSR RCAS sharpening at 0.3, andFILM 2x frame interpolation to 48 fps.Deployment is the split one the unquantized MiniMax-H3 needs: 195.9 GiB of bfloat16 does not fit under a Space's150 GB storage quota, so the 62.14 GiB Qwen3-VL text encoder runs in a separate Space(`multimodalart/qwen3vl-conditioner`) that this one calls per request, and this Space holds the 61.73 GiB71 unmodified linesdef snap_frames(seconds: float) -> int:"""The frame count MiniMax-H3's video VAE can decode: the next `17 * n + 5` at 24 fps.Identical to the workflow's `ComfyMathExpression`,`max(5, round(a*24)) + (5 - (max(5, round(a*24)) % 17)) % 17` — 5 s is 124 frames, i.e. 5.167 s."""34 unmodified linesdef load_models() -> str | None:"""Load the denoising half at startup, plus FILM.`MiniMaxH3GeneratorBlocks` declares `transformer`, `vae`, `audio_vae`, the two schedulers and `video_processor`,so `load_components` fetches exactly those subfolders — `text_encoder/` and `transformer_ref/` are nevertouched. Both autoencoders carry `_keep_in_fp32_modules` over every module and stay float32: a bfloat16 audio8 unmodified linestry:import torchfrom diffusers import ComponentsManagerfrom h3_split_blocks import MiniMaxH3GeneratorBlockslower_duration_floor()manager = ComponentsManager()blocks = MiniMaxH3GeneratorBlocks()print(f"[gen] loading {[c.name for c in blocks.expected_components]} from {MODEL_REPO} ...", flush=True)pipe = blocks.init_pipeline(MODEL_REPO, components_manager=manager, collection="h3")pipe.load_components(dtype=torch.bfloat16)pipe.transformer.set_attention_backend(ATTENTION)# Still startup, still free: an AoTI package carries no weights and opens its archive lazily inside the GPU131 unmodified linesseed,):"""The only thing on GPU time: the denoise loop, the two decoders and the workflow's post chain.The mp4 is muxed here rather than in the caller: a `@spaces.GPU` return crosses a process boundary by pickling,and a 2x-interpolated 124-frame clip is several hundred MB of frames against a few MB of h264."""195 unmodified linesload_models()INTRO = """# PlagueKind · MiniMax-H3<div align="center"><a href="https://huggingface.co/Plaguekind/Minimax-H3" target="_blank" rel="noopener"><strong>[ workflow ]</strong></a> <a href="https://huggingface.co/MiniMaxAI/MiniMax-H3" target="_blank" rel="noopener"><strong>[ model ]</strong></a> <a href="https://github.com/PlagueKind/Comfyui-PlagueKind-Nodes" target="_blank" rel="noopener"><strong>[ nodes ]</strong></a></div>**MiniMax-H3** is a 33B parameter video generation model that produces video and a fully synchronized soundtrack(ambience, foley, speech) in one pass. **PlagueKind's V1.5 workflow** is a tuning of it: euler on a`linear_quadratic` sigma grid at 15 steps, FSR **RCAS** sharpening at 0.3, and **FILM** 2x frame interpolation to48 fps. Text-to-video, first frame, last frame, or both."""CSS = """2 unmodified lines.status p {font-size: 0.8rem; opacity: 0.65; text-align: center;}"""with gr.Blocks(title="PlagueKind · MiniMax-H3") as demo:gr.Markdown(INTRO)gr.Markdown(status(), elem_classes="status")122 unmodified lines"""`Plaguekind/Minimax-H3` ships no weights — it is a ComfyUI graph over `Comfy-Org/MiniMax-H3`. Its nodes map ontothis Space as:| ComfyUI node | widget | here ||---|---|---|| `KSamplerSelect` | `euler` | MiniMax-H3's only sampler; the checkpoint is CFG-distilled, so one forward per step and no negative prompt |5 unmodified lines| `CreateVideo` | fps `24 * 2` | 48 fps output || `RTXVideoSuperResolution` | 2x `ULTRA` | **not reproduced** || `PathchSageAttentionKJ` | `sageattn_qk_int8_pv_fp8_cuda++` | cuDNN fused attention |Two deliberate deviations. `RTXVideoSuperResolution` is NVIDIA's NGX super-resolution, shipped as a driver-levelWindows/RTX component with no Linux Python path, so the 2x upscale is missing — pick a larger **Target dimension**instead of upscaling a small one. And SageAttention's `qk_int8_pv_fp8_cuda++` kernel is not built for this pool'ssm120 cards, so attention runs cuDNN's fused kernel, which is the fastest available here and is numerically thefaithful one (SageAttention is a quantized approximation).One upgrade: the workflow loads `minimax_h3_fl2va_pruned_int8_convrot.safetensors` and a`qwen3vl_32b_..._int8_convrot` text encoder because that is what fits a consumer card. This Space runs both**unquantized bfloat16**, off `MiniMaxAI/MiniMax-H3`, with the 62 GiB text encoder in a6 unmodified linesif __name__ == "__main__":# `theme` and `css` belong to `launch()` from Gradio 6.0 on; on `Blocks` they warn and are ignored.demo.launch(show_error=True, theme=gr.themes.Citrus(), css=CSS)
app.py+8-35