diff --git a/optimized/R2V/minimax/sparse-latent-upscale/README.md b/optimized/R2V/minimax/sparse-latent-upscale/README.md index a7a27cd..fb08c74 100644 --- a/optimized/R2V/minimax/sparse-latent-upscale/README.md +++ b/optimized/R2V/minimax/sparse-latent-upscale/README.md @@ -11,6 +11,8 @@ This workflow variant is based on the supplied CSGlide H3 workflow. It uses: The workflow is preserved in `workflow-source.json`; `workflow.json` is the tracked test copy with the enhanced common prompt and corrected reference filenames. +For the visual ComfyUI editor, load [`workflow-ui.json`](workflow-ui.json). It is the canvas-format version of the same validated baseline, with node positions and links. The API-format `workflow.json` remains the file used by the automated submission scripts. + ## Fixed test input - **References:** `references/Scene022.png` as `@image1`, `references/Char034_TurnaroundFull_001.png` as `@image2` diff --git a/optimized/R2V/minimax/sparse-latent-upscale/workflow-ui.json b/optimized/R2V/minimax/sparse-latent-upscale/workflow-ui.json new file mode 100644 index 0000000..e63d8d1 --- /dev/null +++ b/optimized/R2V/minimax/sparse-latent-upscale/workflow-ui.json @@ -0,0 +1,2508 @@ +{ + "last_node_id": 260, + "last_link_id": 44, + "nodes": [ + { + "id": 119, + "type": "VAELoader", + "pos": [ + 0, + 0 + ], + "size": { + "0": 300, + "1": 120 + }, + "flags": {}, + "order": 0, + "mode": 0, + "inputs": [ + { + "name": "vae_name", + "type": "COMBO", + "widget": { + "name": "vae_name" + } + } + ], + "outputs": [ + { + "name": "VAE", + "type": "VAE", + "links": [ + 13, + 18 + ], + "slot_index": 0 + } + ], + "properties": { + "cnr_id": "Load VAE" + }, + "widgets_values": [ + "minimax_h3_video_vae_int8_convrot.safetensors" + ] + }, + { + "id": 120, + "type": "VAELoader", + "pos": [ + 0, + 180 + ], + "size": { + "0": 300, + "1": 120 + }, + "flags": {}, + "order": 0, + "mode": 0, + "inputs": [ + { + "name": "vae_name", + "type": "COMBO", + "widget": { + "name": "vae_name" + } + } + ], + "outputs": [ + { + "name": "VAE", + "type": "VAE", + "links": [ + 14, + 16 + ], + "slot_index": 0 + } + ], + "properties": { + "cnr_id": "Load VAE" + }, + "widgets_values": [ + "minimax_h3_audio_vae_fp32.safetensors" + ] + }, + { + "id": 123, + "type": "KSamplerSelect", + "pos": [ + 0, + 360 + ], + "size": { + "0": 300, + "1": 120 + }, + "flags": {}, + "order": 0, + "mode": 0, + "inputs": [ + { + "name": "sampler_name", + "type": "COMBO", + "widget": { + "name": "sampler_name" + } + } + ], + "outputs": [ + { + "name": "SAMPLER", + "type": "SAMPLER", + "links": [ + 4 + ], + "slot_index": 0 + } + ], + "properties": { + "cnr_id": "KSamplerSelect" + }, + "widgets_values": [ + "euler" + ] + }, + { + "id": 124, + "type": "BasicScheduler", + "pos": [ + 2880, + 0 + ], + "size": { + "0": 300, + "1": 120 + }, + "flags": {}, + "order": 8, + "mode": 0, + "inputs": [ + { + "name": "model", + "type": "MODEL", + "link": 1 + }, + { + "name": "scheduler", + "type": "COMBO", + "widget": { + "name": "scheduler" + } + }, + { + "name": "steps", + "type": "INT", + "widget": { + "name": "steps" + } + }, + { + "name": "denoise", + "type": "FLOAT", + "widget": { + "name": "denoise" + } + } + ], + "outputs": [ + { + "name": "SIGMAS", + "type": "SIGMAS", + "links": [ + 5 + ], + "slot_index": 0 + } + ], + "properties": { + "cnr_id": "BasicScheduler" + }, + "widgets_values": [ + "beta", + 8, + 1 + ] + }, + { + "id": 125, + "type": "SamplerCustomAdvanced", + "pos": [ + 3240, + 0 + ], + "size": { + "0": 300, + "1": 120 + }, + "flags": {}, + "order": 9, + "mode": 0, + "inputs": [ + { + "name": "noise", + "type": "NOISE", + "link": 2 + }, + { + "name": "guider", + "type": "GUIDER", + "link": 3 + }, + { + "name": "sampler", + "type": "SAMPLER", + "link": 4 + }, + { + "name": "sigmas", + "type": "SIGMAS", + "link": 5 + }, + { + "name": "latent_image", + "type": "LATENT", + "link": 6 + } + ], + "outputs": [ + { + "name": "output", + "type": "LATENT", + "links": [ + 15, + 32 + ], + "slot_index": 0 + }, + { + "name": "denoised_output", + "type": "LATENT", + "links": [], + "slot_index": 1 + } + ], + "properties": { + "cnr_id": "SamplerCustomAdvanced" + }, + "widgets_values": [] + }, + { + "id": 126, + "type": "BasicGuider", + "pos": [ + 2880, + 180 + ], + "size": { + "0": 300, + "1": 120 + }, + "flags": {}, + "order": 8, + "mode": 0, + "inputs": [ + { + "name": "model", + "type": "MODEL", + "link": 7 + }, + { + "name": "conditioning", + "type": "CONDITIONING", + "link": 8 + } + ], + "outputs": [ + { + "name": "GUIDER", + "type": "GUIDER", + "links": [ + 3 + ], + "slot_index": 0 + } + ], + "properties": { + "cnr_id": "Basic Guider" + }, + "widgets_values": [] + }, + { + "id": 128, + "type": "CLIPLoader", + "pos": [ + 0, + 540 + ], + "size": { + "0": 300, + "1": 120 + }, + "flags": {}, + "order": 0, + "mode": 0, + "inputs": [ + { + "name": "clip_name", + "type": "COMBO", + "widget": { + "name": "clip_name" + } + }, + { + "name": "type", + "type": "COMBO", + "widget": { + "name": "type" + } + }, + { + "name": "device", + "type": "COMBO", + "widget": { + "name": "device" + } + } + ], + "outputs": [ + { + "name": "CLIP", + "type": "CLIP", + "links": [ + 12 + ], + "slot_index": 0 + } + ], + "properties": { + "cnr_id": "Load CLIP" + }, + "widgets_values": [ + "qwen3vl_32b_minimax_h3_nvfp4_awq.safetensors", + "minimax", + "default" + ] + }, + { + "id": 129, + "type": "RandomNoise", + "pos": [ + 0, + 720 + ], + "size": { + "0": 300, + "1": 120 + }, + "flags": {}, + "order": 0, + "mode": 0, + "inputs": [ + { + "name": "noise_seed", + "type": "INT", + "widget": { + "name": "noise_seed" + } + } + ], + "outputs": [ + { + "name": "NOISE", + "type": "NOISE", + "links": [ + 2 + ], + "slot_index": 0 + } + ], + "properties": { + "cnr_id": "RandomNoise" + }, + "widgets_values": [ + 317182692766673 + ] + }, + { + "id": 149, + "type": "CSGlideVideoCS", + "pos": [ + 4680, + 0 + ], + "size": { + "0": 300, + "1": 120 + }, + "flags": {}, + "order": 13, + "mode": 0, + "inputs": [ + { + "name": "images", + "type": "IMAGE", + "link": 10 + }, + { + "name": "fps", + "type": "FLOAT", + "widget": { + "name": "fps" + } + }, + { + "name": "preset", + "type": "COMBO", + "widget": { + "name": "preset" + } + }, + { + "name": "filename_prefix", + "type": "STRING", + "link": 9 + }, + { + "name": "save_output", + "type": "BOOLEAN", + "widget": { + "name": "save_output" + } + }, + { + "name": "save_metadata", + "type": "BOOLEAN", + "widget": { + "name": "save_metadata" + } + }, + { + "name": "fallback_on_failure", + "type": "BOOLEAN", + "widget": { + "name": "fallback_on_failure" + } + }, + { + "name": "container", + "type": "COMBO", + "widget": { + "name": "container" + } + }, + { + "name": "audio", + "type": "AUDIO", + "link": 11 + }, + { + "name": "chain", + "type": "STRING", + "widget": { + "name": "chain" + } + } + ], + "outputs": [ + { + "name": "filepath", + "type": "STRING", + "links": [ + 28 + ], + "slot_index": 0 + } + ], + "properties": { + "cnr_id": "Glide Video" + }, + "widgets_values": [ + 24, + "H.264 (compatible)", + true, + true, + true, + "mp4" + ] + }, + { + "id": 153, + "type": "CSGlideCastCS", + "pos": [ + 360, + 0 + ], + "size": { + "0": 300, + "1": 120 + }, + "flags": {}, + "order": 1, + "mode": 0, + "inputs": [ + { + "name": "clip", + "type": "CLIP", + "link": 12 + }, + { + "name": "vae", + "type": "VAE", + "link": 13 + }, + { + "name": "h3_data", + "type": "STRING", + "widget": { + "name": "h3_data" + } + }, + { + "name": "audio_vae", + "type": "VAE", + "link": 14 + }, + { + "name": "first_frame", + "type": "IMAGE", + "widget": { + "name": "first_frame" + } + }, + { + "name": "last_frame", + "type": "IMAGE", + "widget": { + "name": "last_frame" + } + } + ], + "outputs": [ + { + "name": "positive", + "type": "CONDITIONING", + "links": [ + 8, + 31 + ], + "slot_index": 0 + }, + { + "name": "latent", + "type": "LATENT", + "links": [ + 6 + ], + "slot_index": 1 + }, + { + "name": "width", + "type": "INT", + "links": [], + "slot_index": 2 + }, + { + "name": "height", + "type": "INT", + "links": [], + "slot_index": 3 + }, + { + "name": "length", + "type": "INT", + "links": [], + "slot_index": 4 + }, + { + "name": "seconds", + "type": "FLOAT", + "links": [], + "slot_index": 5 + }, + { + "name": "overlap_frames", + "type": "INT", + "links": [ + 20 + ], + "slot_index": 6 + }, + { + "name": "source_video", + "type": "STRING", + "links": [ + 19 + ], + "slot_index": 7 + }, + { + "name": "guide_frames", + "type": "IMAGE", + "links": [], + "slot_index": 8 + }, + { + "name": "positive_refine", + "type": "CONDITIONING", + "links": [], + "slot_index": 9 + }, + { + "name": "clip_name", + "type": "STRING", + "links": [ + 9 + ], + "slot_index": 10 + } + ], + "properties": { + "cnr_id": "H3 Studio" + }, + "widgets_values": [ + "{\"mode\":\"ref2va\",\"width\":672,\"height\":384,\"length\":243,\"ref_image_size\":\"match\",\"ref_refine_scale\":1,\"pace\":2.5,\"prompt\":\"detailed_description:\\n@image1 is the environment and master scene reference. Preserve the wheat field, distant tree line, daylight, atmospheric perspective and spatial layout throughout the clip. @image2 is the character reference; preserve her identity, face, long pale-blonde hair, black outfit, body proportions and visible butterfly hair ornament consistently.\\n\\nCreate a premium photorealistic fantasy-film shot in which the adult woman from @image2 stands in the field from @image1 while an enormous ancient dragon occupies the middle distance. Keep the tone majestic and cinematic rather than comedic or violent. The woman remains calm, confident and physically grounded; the dragon is powerful and irritated but believable, with detailed scales, leathery wings, articulated joints, natural breathing and convincing weight. Use warm late-afternoon sunlight, volumetric atmosphere, realistic shadows on the wheat and a restrained cinematic colour grade. No modern objects, logos, subtitles, watermarks or unexplained changes of wardrobe.\\n\\n[Shot 1] At 00:00.000, establish a wide view of the adult woman standing in the wheat field with the dragon behind and to one side. The dragon watches her with tense posture and slowly flexes its wings. Wheat moves in the wind and both subjects remain anatomically stable.\\n\\n[Shot 2] At 00:02.500, move to a medium over-the-shoulder composition from behind the woman toward the dragon. The dragon lowers its head, opens its mouth and gives a powerful roar without breathing fire. Dust and wheat respond subtly to the force of the breath; keep the woman composed.\\n\\n[Shot 3] At 00:05.000, cut to a closer side angle as the woman turns toward the dragon and raises one open palm in a clear stop gesture. The dragon leans closer, agitated but cautious. Maintain the same faces, hair, clothing, scale relationship and sunlight direction.\\n\\n[Shot 4] At 00:07.500, the woman makes one decisive, physically readable open-handed slap across the dragon's snout. Keep it stylised and non-graphic: no injury, blood or broken anatomy. The dragon recoils with a startled whimper and folds its head slightly.\\n\\n[Shot 5] At 00:09.000, return to a cinematic medium-wide view. The dragon is now meek and subdued while the woman turns back toward camera, spreads her arms slightly and gives a silent, incredulous expression. End with a natural breeze, settling wings and stable continuity through the final frame.\\n\\noverall_soundscape: Warm open-field wind, wheat brushing together, distant birds, heavy dragon breathing, wing fabric and joints moving, one powerful roar, the soft physical sound of the slap and a subdued dragon whimper. No dialogue, no screaming and no modern sound effects.\\n\\nnon_diegetic_music: N/A. Keep the test free of music so image and motion quality can be compared directly.\\n\",\"slots\":{\"first\":{},\"last\":{},\"images\":[{\"file\":\"cglide/Scene022.png\"},{\"file\":\"cglide/Char034_TurnaroundFull_001.png\"},{},{},{},{},{},{},{}],\"videos\":[{},{},{}],\"audios\":[{},{},{}]},\"cont\":{},\"clip\":null}" + ] + }, + { + "id": 174, + "type": "VAEDecodeAudio", + "pos": [ + 3600, + 0 + ], + "size": { + "0": 300, + "1": 120 + }, + "flags": {}, + "order": 10, + "mode": 0, + "inputs": [ + { + "name": "samples", + "type": "LATENT", + "link": 15 + }, + { + "name": "vae", + "type": "VAE", + "link": 16 + } + ], + "outputs": [ + { + "name": "AUDIO", + "type": "AUDIO", + "links": [ + 22 + ], + "slot_index": 0 + } + ], + "properties": { + "cnr_id": "VAE Decode Audio" + }, + "widgets_values": [] + }, + { + "id": 176, + "type": "VAEDecode", + "pos": [ + 3960, + 0 + ], + "size": { + "0": 300, + "1": 120 + }, + "flags": {}, + "order": 11, + "mode": 0, + "inputs": [ + { + "name": "samples", + "type": "LATENT", + "link": 17 + }, + { + "name": "vae", + "type": "VAE", + "link": 18 + } + ], + "outputs": [ + { + "name": "IMAGE", + "type": "IMAGE", + "links": [ + 21 + ], + "slot_index": 0 + } + ], + "properties": { + "cnr_id": "VAE Decode" + }, + "widgets_values": [] + }, + { + "id": 186, + "type": "CSGlideJoinCS", + "pos": [ + 4320, + 0 + ], + "size": { + "0": 300, + "1": 120 + }, + "flags": {}, + "order": 12, + "mode": 0, + "inputs": [ + { + "name": "source_video", + "type": "STRING", + "link": 19 + }, + { + "name": "images", + "type": "IMAGE", + "link": 21 + }, + { + "name": "overlap_frames", + "type": "INT", + "link": 20 + }, + { + "name": "seam_mode", + "type": "COMBO", + "widget": { + "name": "seam_mode" + } + }, + { + "name": "seam_blend_frames", + "type": "INT", + "widget": { + "name": "seam_blend_frames" + } + }, + { + "name": "match_levels", + "type": "BOOLEAN", + "widget": { + "name": "match_levels" + } + }, + { + "name": "audio", + "type": "AUDIO", + "link": 22 + }, + { + "name": "fps", + "type": "FLOAT", + "widget": { + "name": "fps" + } + }, + { + "name": "match_tail", + "type": "BOOLEAN", + "widget": { + "name": "match_tail" + } + } + ], + "outputs": [ + { + "name": "images", + "type": "IMAGE", + "links": [ + 10 + ], + "slot_index": 0 + }, + { + "name": "audio", + "type": "AUDIO", + "links": [ + 11 + ], + "slot_index": 1 + }, + { + "name": "frame_count", + "type": "INT", + "links": [], + "slot_index": 2 + }, + { + "name": "chain", + "type": "STRING", + "links": [], + "slot_index": 3 + } + ], + "properties": { + "cnr_id": "Glide Join" + }, + "widgets_values": [ + "early_cut", + 6, + true, + 24, + true + ] + }, + { + "id": 204, + "type": "ModelAttentionBackend", + "pos": [ + 1080, + 0 + ], + "size": { + "0": 300, + "1": 120 + }, + "flags": {}, + "order": 3, + "mode": 0, + "inputs": [ + { + "name": "model", + "type": "MODEL", + "link": 23 + }, + { + "name": "attention", + "type": "COMBO", + "widget": { + "name": "attention" + } + } + ], + "outputs": [ + { + "name": "model", + "type": "MODEL", + "links": [ + 24 + ], + "slot_index": 0 + } + ], + "properties": { + "cnr_id": "Model Attention Backend" + }, + "widgets_values": [ + "comfy kitchen attention" + ] + }, + { + "id": 205, + "type": "MiniMaxLowVRAMAttention", + "pos": [ + 1440, + 0 + ], + "size": { + "0": 300, + "1": 120 + }, + "flags": {}, + "order": 4, + "mode": 0, + "inputs": [ + { + "name": "model", + "type": "MODEL", + "link": 24 + }, + { + "name": "head_chunks", + "type": "INT", + "widget": { + "name": "head_chunks" + } + } + ], + "outputs": [ + { + "name": "model", + "type": "MODEL", + "links": [ + 25 + ], + "slot_index": 0 + } + ], + "properties": { + "cnr_id": "MiniMax H3 Low VRAM Attention" + }, + "widgets_values": [ + 4 + ] + }, + { + "id": 206, + "type": "MiniMaxChunkFeedForward", + "pos": [ + 1800, + 0 + ], + "size": { + "0": 300, + "1": 120 + }, + "flags": {}, + "order": 5, + "mode": 0, + "inputs": [ + { + "name": "model", + "type": "MODEL", + "link": 25 + }, + { + "name": "chunks", + "type": "INT", + "widget": { + "name": "chunks" + } + }, + { + "name": "seq_threshold", + "type": "INT", + "widget": { + "name": "seq_threshold" + } + } + ], + "outputs": [ + { + "name": "model", + "type": "MODEL", + "links": [ + 27 + ], + "slot_index": 0 + } + ], + "properties": { + "cnr_id": "MiniMax H3 Chunk FeedForward" + }, + "widgets_values": [ + 2, + 4096 + ] + }, + { + "id": 212, + "type": "ModelPreviewOverrideKJ", + "pos": [ + 2520, + 0 + ], + "size": { + "0": 300, + "1": 120 + }, + "flags": {}, + "order": 7, + "mode": 0, + "inputs": [ + { + "name": "model", + "type": "MODEL", + "link": 26 + }, + { + "name": "max_resolution", + "type": "INT", + "widget": { + "name": "max_resolution" + } + }, + { + "name": "jpeg_quality", + "type": "INT", + "widget": { + "name": "jpeg_quality" + } + }, + { + "name": "suppress_default_preview", + "type": "BOOLEAN", + "widget": { + "name": "suppress_default_preview" + } + }, + { + "name": "preview_frames", + "type": "INT", + "widget": { + "name": "preview_frames" + } + }, + { + "name": "preview_fps", + "type": "INT", + "widget": { + "name": "preview_fps" + } + }, + { + "name": "vae", + "type": "VAE", + "widget": { + "name": "vae" + } + }, + { + "name": "tiny_vae", + "type": "COMBO", + "widget": { + "name": "tiny_vae" + } + }, + { + "name": "audio_vae", + "type": "VAE", + "widget": { + "name": "audio_vae" + } + } + ], + "outputs": [ + { + "name": "MODEL", + "type": "MODEL", + "links": [ + 1, + 7, + 30, + 40 + ], + "slot_index": 0 + } + ], + "properties": { + "cnr_id": "Model Preview Override" + }, + "widgets_values": [ + 1024, + 80, + true, + 241, + 7, + "taeh3.safetensors" + ] + }, + { + "id": 216, + "type": "Power Lora Loader (rgthree)", + "pos": [ + 2160, + 0 + ], + "size": { + "0": 300, + "1": 120 + }, + "flags": {}, + "order": 6, + "mode": 0, + "inputs": [ + { + "name": "model", + "type": "MODEL", + "link": 27 + }, + { + "name": "clip", + "type": "CLIP", + "widget": { + "name": "clip" + } + }, + { + "name": "PowerLoraLoaderHeaderWidget", + "type": "STRING", + "widget": { + "name": "PowerLoraLoaderHeaderWidget" + } + }, + { + "name": "lora_1", + "type": "STRING", + "widget": { + "name": "lora_1" + } + }, + { + "name": "lora_2", + "type": "STRING", + "widget": { + "name": "lora_2" + } + }, + { + "name": "➕ Add Lora", + "type": "STRING", + "widget": { + "name": "➕ Add Lora" + } + } + ], + "outputs": [ + { + "name": "MODEL", + "type": "MODEL", + "links": [ + 26 + ], + "slot_index": 0 + }, + { + "name": "CLIP", + "type": "CLIP", + "links": [], + "slot_index": 1 + } + ], + "properties": { + "cnr_id": "Power Lora Loader (rgthree)" + }, + "widgets_values": [ + { + "type": "PowerLoraLoaderHeaderWidget" + }, + { + "on": true, + "lora": "minimax\\VBVR_H3_attn_only.safetensors", + "strength": 0.8 + }, + { + "on": true, + "lora": "minimax\\MysticXXX_MMH3-V4-ref2va.safetensors", + "strength": 0.45 + }, + "" + ] + }, + { + "id": 217, + "type": "easy showAnything", + "pos": [ + 5040, + 0 + ], + "size": { + "0": 300, + "1": 120 + }, + "flags": {}, + "order": 14, + "mode": 0, + "inputs": [ + { + "name": "anything", + "type": "*", + "link": 28 + }, + { + "name": "text", + "type": "STRING", + "widget": { + "name": "text" + } + } + ], + "outputs": [ + { + "name": "output", + "type": "*", + "links": [], + "slot_index": 0 + } + ], + "properties": { + "cnr_id": "Show Any" + }, + "widgets_values": [ + "C:\\AI\\ComfyUI_windows_portable\\ComfyUI\\output\\glide_00007.mp4" + ] + }, + { + "id": 220, + "type": "EasyCache", + "pos": [ + 720, + 0 + ], + "size": { + "0": 300, + "1": 120 + }, + "flags": {}, + "order": 2, + "mode": 0, + "inputs": [ + { + "name": "model", + "type": "MODEL", + "link": 29 + }, + { + "name": "reuse_threshold", + "type": "FLOAT", + "widget": { + "name": "reuse_threshold" + } + }, + { + "name": "start_percent", + "type": "FLOAT", + "widget": { + "name": "start_percent" + } + }, + { + "name": "end_percent", + "type": "FLOAT", + "widget": { + "name": "end_percent" + } + }, + { + "name": "verbose", + "type": "BOOLEAN", + "widget": { + "name": "verbose" + } + } + ], + "outputs": [ + { + "name": "MODEL", + "type": "MODEL", + "links": [ + 23 + ], + "slot_index": 0 + } + ], + "properties": { + "cnr_id": "EasyCache" + }, + "widgets_values": [ + 0.3, + 0.2, + 0.9, + false + ] + }, + { + "id": 236, + "type": "MMH3UltimateUpscale", + "pos": [ + 3600, + 180 + ], + "size": { + "0": 300, + "1": 120 + }, + "flags": {}, + "order": 10, + "mode": 0, + "inputs": [ + { + "name": "model", + "type": "MODEL", + "link": 30 + }, + { + "name": "conditioning", + "type": "CONDITIONING", + "link": 31 + }, + { + "name": "latent", + "type": "LATENT", + "link": 32 + }, + { + "name": "noise", + "type": "NOISE", + "link": 33 + }, + { + "name": "sampler", + "type": "SAMPLER", + "link": 34 + }, + { + "name": "sigmas", + "type": "SIGMAS", + "link": 35 + }, + { + "name": "cfg", + "type": "FLOAT", + "widget": { + "name": "cfg" + } + }, + { + "name": "negative", + "type": "CONDITIONING", + "widget": { + "name": "negative" + } + }, + { + "name": "latent_upscale_param", + "type": "H3_UPSCALE_PARAM", + "link": 36 + }, + { + "name": "temporal_split_param", + "type": "H3_TEMPORAL_PARAM", + "widget": { + "name": "temporal_split_param" + } + }, + { + "name": "spatial_split_param", + "type": "H3_SPATIAL_PARAM", + "link": 37 + } + ], + "outputs": [ + { + "name": "latent", + "type": "LATENT", + "links": [ + 17 + ], + "slot_index": 0 + }, + { + "name": "segments_info", + "type": "DICT", + "links": [ + 42 + ], + "slot_index": 1 + }, + { + "name": "tiles_info", + "type": "DICT", + "links": [ + 41 + ], + "slot_index": 2 + } + ], + "properties": { + "cnr_id": "MMH3 Ultimate Upscale" + }, + "widgets_values": [ + 1 + ] + }, + { + "id": 238, + "type": "MMH3LatentUpscaleWithModelParams", + "pos": [ + 360, + 180 + ], + "size": { + "0": 300, + "1": 120 + }, + "flags": {}, + "order": 1, + "mode": 0, + "inputs": [ + { + "name": "model_name", + "type": "COMBO", + "widget": { + "name": "model_name" + } + }, + { + "name": "width", + "type": "INT", + "link": 38 + }, + { + "name": "height", + "type": "INT", + "link": 39 + }, + { + "name": "device", + "type": "COMBO", + "widget": { + "name": "device" + } + }, + { + "name": "precision", + "type": "COMBO", + "widget": { + "name": "precision" + } + } + ], + "outputs": [ + { + "name": "latent_upscale_param", + "type": "H3_UPSCALE_PARAM", + "links": [ + 36 + ], + "slot_index": 0 + } + ], + "properties": { + "cnr_id": "MMH3 Latent Upscale with Model Params" + }, + "widgets_values": [ + "minimax_h3_latent_upscaler_3d_conv_v1_fp16.safetensors", + "cuda", + "fp16" + ] + }, + { + "id": 241, + "type": "BasicScheduler", + "pos": [ + 2880, + 360 + ], + "size": { + "0": 300, + "1": 120 + }, + "flags": {}, + "order": 8, + "mode": 0, + "inputs": [ + { + "name": "model", + "type": "MODEL", + "link": 40 + }, + { + "name": "scheduler", + "type": "COMBO", + "widget": { + "name": "scheduler" + } + }, + { + "name": "steps", + "type": "INT", + "widget": { + "name": "steps" + } + }, + { + "name": "denoise", + "type": "FLOAT", + "widget": { + "name": "denoise" + } + } + ], + "outputs": [ + { + "name": "SIGMAS", + "type": "SIGMAS", + "links": [ + 35 + ], + "slot_index": 0 + } + ], + "properties": { + "cnr_id": "BasicScheduler" + }, + "widgets_values": [ + "simple", + 3, + 0.2 + ] + }, + { + "id": 242, + "type": "KSamplerSelect", + "pos": [ + 0, + 900 + ], + "size": { + "0": 300, + "1": 120 + }, + "flags": {}, + "order": 0, + "mode": 0, + "inputs": [ + { + "name": "sampler_name", + "type": "COMBO", + "widget": { + "name": "sampler_name" + } + } + ], + "outputs": [ + { + "name": "SAMPLER", + "type": "SAMPLER", + "links": [ + 34 + ], + "slot_index": 0 + } + ], + "properties": { + "cnr_id": "KSamplerSelect" + }, + "widgets_values": [ + "sa_solver" + ] + }, + { + "id": 243, + "type": "RandomNoise", + "pos": [ + 0, + 1080 + ], + "size": { + "0": 300, + "1": 120 + }, + "flags": {}, + "order": 0, + "mode": 0, + "inputs": [ + { + "name": "noise_seed", + "type": "INT", + "widget": { + "name": "noise_seed" + } + } + ], + "outputs": [ + { + "name": "NOISE", + "type": "NOISE", + "links": [ + 33 + ], + "slot_index": 0 + } + ], + "properties": { + "cnr_id": "RandomNoise" + }, + "widgets_values": [ + 363742558835919 + ] + }, + { + "id": 245, + "type": "PixaromaResolution", + "pos": [ + 0, + 1260 + ], + "size": { + "0": 300, + "1": 120 + }, + "flags": {}, + "order": 0, + "mode": 0, + "inputs": [ + { + "name": "ResolutionState", + "type": "STRING", + "widget": { + "name": "ResolutionState" + } + } + ], + "outputs": [ + { + "name": "width", + "type": "INT", + "links": [ + 38 + ], + "slot_index": 0 + }, + { + "name": "height", + "type": "INT", + "links": [ + 39 + ], + "slot_index": 1 + } + ], + "properties": { + "cnr_id": "Resolution Pixaroma" + }, + "widgets_values": [ + "{\"mode\":\"preset\",\"ratio\":\"16:9\",\"w\":1920,\"h\":1080,\"custom_w\":1024,\"custom_h\":1024,\"custom_ratio_w\":4,\"custom_ratio_h\":3,\"snap\":16}" + ] + }, + { + "id": 247, + "type": "easy showAnything", + "pos": [ + 3960, + 180 + ], + "size": { + "0": 300, + "1": 120 + }, + "flags": {}, + "order": 11, + "mode": 0, + "inputs": [ + { + "name": "anything", + "type": "*", + "link": 41 + }, + { + "name": "text", + "type": "STRING", + "widget": { + "name": "text" + } + } + ], + "outputs": [ + { + "name": "output", + "type": "*", + "links": [], + "slot_index": 0 + } + ], + "properties": { + "cnr_id": "Show Any" + }, + "widgets_values": [ + { + "rows": [ + 0, + 22 + ], + "cols": [ + 0, + 46 + ], + "tile_rows": [ + 30, + 26 + ], + "tile_cols": [ + 54, + 38 + ], + "row_overlaps": [ + 0, + 8 + ], + "col_overlaps": [ + 0, + 8 + ], + "orig_h": 48, + "orig_w": 84, + "joint": true, + "steps": 3, + "tiles": 4, + "chunk": 0 + } + ] + }, + { + "id": 248, + "type": "easy showAnything", + "pos": [ + 3960, + 360 + ], + "size": { + "0": 300, + "1": 120 + }, + "flags": {}, + "order": 11, + "mode": 0, + "inputs": [ + { + "name": "anything", + "type": "*", + "link": 42 + }, + { + "name": "text", + "type": "STRING", + "widget": { + "name": "text" + } + } + ], + "outputs": [ + { + "name": "output", + "type": "*", + "links": [], + "slot_index": 0 + } + ], + "properties": { + "cnr_id": "Show Any" + }, + "widgets_values": [ + { + "chunk": 0, + "frame_start": 0, + "frame_count": 243, + "video_tokens": [ + 0, + 72 + ], + "audio_tokens": [ + 0, + 405 + ], + "upscaled": true, + "spatial_h": 48, + "spatial_w": 84 + } + ] + }, + { + "id": 249, + "type": "MMH3SpatialSplitParams", + "pos": [ + 360, + 360 + ], + "size": { + "0": 300, + "1": 120 + }, + "flags": {}, + "order": 1, + "mode": 0, + "inputs": [ + { + "name": "upscale_width", + "type": "INT", + "widget": { + "name": "upscale_width" + } + }, + { + "name": "upscale_height", + "type": "INT", + "link": 43 + }, + { + "name": "tile_size_mode", + "type": "COMBO", + "widget": { + "name": "tile_size_mode" + } + }, + { + "name": "tile_width", + "type": "INT", + "widget": { + "name": "tile_width" + } + }, + { + "name": "tile_height", + "type": "INT", + "widget": { + "name": "tile_height" + } + }, + { + "name": "grid_rows", + "type": "INT", + "widget": { + "name": "grid_rows" + } + }, + { + "name": "grid_cols", + "type": "INT", + "widget": { + "name": "grid_cols" + } + }, + { + "name": "spatial_w_overlap", + "type": "INT", + "widget": { + "name": "spatial_w_overlap" + } + }, + { + "name": "spatial_h_overlap", + "type": "INT", + "widget": { + "name": "spatial_h_overlap" + } + }, + { + "name": "fade_width", + "type": "INT", + "widget": { + "name": "fade_width" + } + }, + { + "name": "fade_height", + "type": "INT", + "widget": { + "name": "fade_height" + } + }, + { + "name": "min_tile_size", + "type": "INT", + "widget": { + "name": "min_tile_size" + } + }, + { + "name": "overlap_mode", + "type": "COMBO", + "widget": { + "name": "overlap_mode" + } + }, + { + "name": "overlap_blend", + "type": "COMBO", + "widget": { + "name": "overlap_blend" + } + }, + { + "name": "joint_steps", + "type": "BOOLEAN", + "widget": { + "name": "joint_steps" + } + }, + { + "name": "token_budget", + "type": "INT", + "widget": { + "name": "token_budget" + } + } + ], + "outputs": [ + { + "name": "spatial_split_param", + "type": "H3_SPATIAL_PARAM", + "links": [ + 37 + ], + "slot_index": 0 + }, + { + "name": "tile_width", + "type": "INT", + "links": [], + "slot_index": 1 + }, + { + "name": "tile_height", + "type": "INT", + "links": [], + "slot_index": 2 + } + ], + "properties": { + "cnr_id": "MMH3 Spatial Split Params" + }, + "widgets_values": [ + 1920, + "specific_size", + 1024, + 640, + 2, + 2, + 96, + 96, + 64, + 64, + 256, + "later", + "linear", + 0.05, + 4096 + ] + }, + { + "id": 250, + "type": "BlockSparseAttention", + "pos": [ + 360, + 540 + ], + "size": { + "0": 300, + "1": 120 + }, + "flags": {}, + "order": 1, + "mode": 0, + "inputs": [ + { + "name": "model", + "type": "MODEL", + "link": 44 + }, + { + "name": "selection", + "type": "COMFY_DYNAMICCOMBO_V3", + "widget": { + "name": "selection" + } + }, + { + "name": "start_percent", + "type": "FLOAT", + "widget": { + "name": "start_percent" + } + }, + { + "name": "end_percent", + "type": "FLOAT", + "widget": { + "name": "end_percent" + } + }, + { + "name": "dense_blocks", + "type": "STRING", + "widget": { + "name": "dense_blocks" + } + }, + { + "name": "min_tokens", + "type": "INT", + "widget": { + "name": "min_tokens" + } + }, + { + "name": "extra_tokens", + "type": "INT", + "widget": { + "name": "extra_tokens" + } + }, + { + "name": "sink_conditioning", + "type": "COMBO", + "widget": { + "name": "sink_conditioning" + } + }, + { + "name": "verbose", + "type": "BOOLEAN", + "widget": { + "name": "verbose" + } + }, + { + "name": "selection.keep_percent", + "type": "INT", + "widget": { + "name": "selection.keep_percent" + } + } + ], + "outputs": [ + { + "name": "model", + "type": "MODEL", + "links": [ + 29 + ], + "slot_index": 0 + } + ], + "properties": { + "cnr_id": "Model Sparse Attention" + }, + "widgets_values": [ + "vsa", + 0.2, + 1, + "", + 12288, + 256, + "exact_kv_and_rows", + false, + 10 + ] + }, + { + "id": 251, + "type": "UNETLoader", + "pos": [ + 0, + 1440 + ], + "size": { + "0": 300, + "1": 120 + }, + "flags": {}, + "order": 0, + "mode": 0, + "inputs": [ + { + "name": "unet_name", + "type": "COMBO", + "widget": { + "name": "unet_name" + } + }, + { + "name": "weight_dtype", + "type": "COMBO", + "widget": { + "name": "weight_dtype" + } + } + ], + "outputs": [ + { + "name": "MODEL", + "type": "MODEL", + "links": [ + 44 + ], + "slot_index": 0 + } + ], + "properties": { + "cnr_id": "Load Diffusion Model" + }, + "widgets_values": [ + "fastvideo_fasth3_8step_v2_pruned_int8_convrot.safetensors", + "default" + ] + }, + { + "id": 260, + "type": "PixaromaResolution", + "pos": [ + 0, + 1620 + ], + "size": { + "0": 300, + "1": 120 + }, + "flags": {}, + "order": 0, + "mode": 0, + "inputs": [ + { + "name": "ResolutionState", + "type": "STRING", + "widget": { + "name": "ResolutionState" + } + } + ], + "outputs": [ + { + "name": "width", + "type": "INT", + "links": [ + 43 + ], + "slot_index": 0 + }, + { + "name": "height", + "type": "INT", + "links": [], + "slot_index": 1 + } + ], + "properties": { + "cnr_id": "Resolution Pixaroma" + }, + "widgets_values": [ + "{\"mode\":\"preset\",\"ratio\":\"16:9\",\"w\":1920,\"h\":1080,\"custom_w\":1024,\"custom_h\":1024,\"custom_ratio_w\":4,\"custom_ratio_h\":3,\"snap\":16}" + ] + } + ], + "links": [ + [ + 1, + 212, + 0, + 124, + 0, + "MODEL" + ], + [ + 2, + 129, + 0, + 125, + 0, + "NOISE" + ], + [ + 3, + 126, + 0, + 125, + 1, + "GUIDER" + ], + [ + 4, + 123, + 0, + 125, + 2, + "SAMPLER" + ], + [ + 5, + 124, + 0, + 125, + 3, + "SIGMAS" + ], + [ + 6, + 153, + 1, + 125, + 4, + "LATENT" + ], + [ + 7, + 212, + 0, + 126, + 0, + "MODEL" + ], + [ + 8, + 153, + 0, + 126, + 1, + "CONDITIONING" + ], + [ + 9, + 153, + 10, + 149, + 3, + "STRING" + ], + [ + 10, + 186, + 0, + 149, + 0, + "IMAGE" + ], + [ + 11, + 186, + 1, + 149, + 8, + "AUDIO" + ], + [ + 12, + 128, + 0, + 153, + 0, + "CLIP" + ], + [ + 13, + 119, + 0, + 153, + 1, + "VAE" + ], + [ + 14, + 120, + 0, + 153, + 3, + "VAE" + ], + [ + 15, + 125, + 0, + 174, + 0, + "LATENT" + ], + [ + 16, + 120, + 0, + 174, + 1, + "VAE" + ], + [ + 17, + 236, + 0, + 176, + 0, + "LATENT" + ], + [ + 18, + 119, + 0, + 176, + 1, + "VAE" + ], + [ + 19, + 153, + 7, + 186, + 0, + "STRING" + ], + [ + 20, + 153, + 6, + 186, + 2, + "INT" + ], + [ + 21, + 176, + 0, + 186, + 1, + "IMAGE" + ], + [ + 22, + 174, + 0, + 186, + 6, + "AUDIO" + ], + [ + 23, + 220, + 0, + 204, + 0, + "MODEL" + ], + [ + 24, + 204, + 0, + 205, + 0, + "MODEL" + ], + [ + 25, + 205, + 0, + 206, + 0, + "MODEL" + ], + [ + 26, + 216, + 0, + 212, + 0, + "MODEL" + ], + [ + 27, + 206, + 0, + 216, + 0, + "MODEL" + ], + [ + 28, + 149, + 0, + 217, + 0, + "STRING" + ], + [ + 29, + 250, + 0, + 220, + 0, + "MODEL" + ], + [ + 30, + 212, + 0, + 236, + 0, + "MODEL" + ], + [ + 31, + 153, + 0, + 236, + 1, + "CONDITIONING" + ], + [ + 32, + 125, + 0, + 236, + 2, + "LATENT" + ], + [ + 33, + 243, + 0, + 236, + 3, + "NOISE" + ], + [ + 34, + 242, + 0, + 236, + 4, + "SAMPLER" + ], + [ + 35, + 241, + 0, + 236, + 5, + "SIGMAS" + ], + [ + 36, + 238, + 0, + 236, + 8, + "H3_UPSCALE_PARAM" + ], + [ + 37, + 249, + 0, + 236, + 10, + "H3_SPATIAL_PARAM" + ], + [ + 38, + 245, + 0, + 238, + 1, + "INT" + ], + [ + 39, + 245, + 1, + 238, + 2, + "INT" + ], + [ + 40, + 212, + 0, + 241, + 0, + "MODEL" + ], + [ + 41, + 236, + 2, + 247, + 0, + "DICT" + ], + [ + 42, + 236, + 1, + 248, + 0, + "DICT" + ], + [ + 43, + 260, + 0, + 249, + 1, + "INT" + ], + [ + 44, + 251, + 0, + 250, + 0, + "MODEL" + ] + ], + "groups": [], + "config": {}, + "extra": { + "ds": { + "scale": 0.65, + "offset": [ + 0, + 0 + ] + }, + "workflow_stable_id": "minimax-h3-sparse-latent-upscale-ui" + }, + "version": 0.4 +} diff --git a/scripts/api-to-comfyui-workflow.mjs b/scripts/api-to-comfyui-workflow.mjs new file mode 100644 index 0000000..b266364 --- /dev/null +++ b/scripts/api-to-comfyui-workflow.mjs @@ -0,0 +1,138 @@ +#!/usr/bin/env node +import fs from 'node:fs'; +import path from 'node:path'; + +const server = process.env.COMFYUI_URL || 'http://192.168.1.202:8188'; +const source = path.resolve(process.argv[2] || 'optimized/R2V/minimax/sparse-latent-upscale/workflow.json'); +const target = path.resolve(process.argv[3] || path.join(path.dirname(source), 'workflow-ui.json')); +const graph = JSON.parse(fs.readFileSync(source, 'utf8')); +const info = await fetch(`${server}/object_info`).then((r) => r.json()); +const ids = Object.keys(graph); +const idSet = new Set(ids); +const schemas = new Map(ids.map((id) => [id, info[graph[id].class_type] || {}])); +const links = []; +let nextLink = 1; +const dependencies = new Map(ids.map((id) => [id, []])); + +function connected(value) { + return Array.isArray(value) && value.length === 2 && idSet.has(String(value[0])); +} + +function schemaInput(nodeId, name) { + const schema = schemas.get(nodeId) || {}; + return schema.input?.required?.[name] || schema.input?.optional?.[name] || null; +} + +function inputOrder(nodeId) { + const order = schemas.get(nodeId)?.input_order || {}; + return [...(order.required || []), ...(order.optional || [])]; +} + +function typeOf(nodeId, name, value) { + const spec = schemaInput(nodeId, name); + if (spec?.[0]) return Array.isArray(spec[0]) ? 'COMBO' : spec[0]; + if (connected(value)) return 'LINK'; + if (typeof value === 'boolean') return 'BOOLEAN'; + if (typeof value === 'number') return Number.isInteger(value) ? 'INT' : 'FLOAT'; + return 'STRING'; +} + +function outputName(nodeId, slot) { + return schemas.get(nodeId)?.output_name?.[slot] || `output_${slot}`; +} + +function outputType(nodeId, slot) { + return schemas.get(nodeId)?.output?.[slot] || '*'; +} + +for (const [targetId, node] of Object.entries(graph)) { + for (const [inputName, value] of Object.entries(node.inputs || {})) { + if (!connected(value)) continue; + const originId = String(value[0]); + const originSlot = Number(value[1]); + const linkId = nextLink++; + links.push([linkId, Number(originId), originSlot, Number(targetId), inputOrder(targetId).indexOf(inputName), outputType(originId, originSlot)]); + dependencies.get(targetId).push(originId); + } +} + +const levels = new Map(); +function level(id, visiting = new Set()) { + if (levels.has(id)) return levels.get(id); + if (visiting.has(id)) return 0; + visiting.add(id); + const value = Math.max(-1, ...(dependencies.get(id) || []).map((dep) => level(dep, visiting))) + 1; + levels.set(id, value); + return value; +} +ids.forEach((id) => level(id)); +const byLevel = new Map(); +for (const id of ids) { + const group = byLevel.get(level(id)) || []; + group.push(id); + byLevel.set(level(id), group); +} + +function inputEntries(nodeId, node) { + const schemaNames = inputOrder(nodeId); + const names = [...new Set([...schemaNames, ...Object.keys(node.inputs || {})])]; + const out = []; + for (const name of names) { + const value = node.inputs?.[name]; + const link = links.find((item) => item[3] === Number(nodeId) && item[4] === schemaNames.indexOf(name)); + const spec = schemaInput(nodeId, name); + const type = typeOf(nodeId, name, value); + if (link) out.push({ name, type, link: link[0] }); + else if (schemaNames.includes(name) || Object.prototype.hasOwnProperty.call(node.inputs || {}, name)) out.push({ name, type, widget: { name } }); + } + return out; +} + +function widgetValues(nodeId, node) { + const schemaNames = inputOrder(nodeId); + const unknown = Object.keys(node.inputs || {}).filter((name) => !schemaNames.includes(name) && !connected(node.inputs[name])); + const names = [...schemaNames, ...unknown].filter((name) => Object.prototype.hasOwnProperty.call(node.inputs || {}, name) && !connected(node.inputs[name])); + return names.map((name) => node.inputs[name]); +} + +const uiNodes = ids.map((id) => { + const node = graph[id]; + const schema = schemas.get(id) || {}; + const outputs = (schema.output || []).map((type, slot) => ({ + name: outputName(id, slot), + type, + links: links.filter((item) => item[1] === Number(id) && item[2] === slot).map((item) => item[0]), + slot_index: slot, + })); + const column = level(id); + const row = (byLevel.get(column) || []).indexOf(id); + return { + id: Number(id), + type: node.class_type, + pos: [column * 360, row * 180], + size: { 0: 300, 1: 120 }, + flags: {}, + order: column, + mode: 0, + inputs: inputEntries(id, node), + outputs, + properties: { cnr_id: node._meta?.title || node.class_type }, + widgets_values: widgetValues(id, node), + }; +}); + +const workflow = { + last_node_id: Math.max(...ids.map(Number)), + last_link_id: links.length, + nodes: uiNodes, + links, + groups: [], + config: {}, + extra: { + ds: { scale: 0.65, offset: [0, 0] }, + workflow_stable_id: 'minimax-h3-sparse-latent-upscale-ui', + }, + version: 0.4, +}; +fs.writeFileSync(target, `${JSON.stringify(workflow, null, 2)}\n`); +console.log(JSON.stringify({ source, target, nodes: uiNodes.length, links: links.length }, null, 2));