Spaces:
Running on Zero
Running on Zero
feat: add MiniMax-H3-Image, fix reference image slot indices, bump requirements
Browse filesFiles changed (11)
- README.md+2
- chain_injectors/reference_image_injector.py+94-4
- core/pipelines/workflow_recipes/_partials/conditioning/minimax-h3-image.yamlAdded+72
- requirements.txt+4-4
- yaml/chain_features.yaml+15
- yaml/constants.yaml+8
- yaml/file_list.yaml+15
- yaml/model_architecture_features.yaml+5
- yaml/model_architectures.yaml+3
- yaml/model_defaults.yaml+7
- yaml/model_list.yaml+8
56 unmodified lines57585960616263124 unmodified lines18818919019119219319456 unmodified lines - Comfy-Org/Lumina_Image_2.0_Repackaged
- Comfy-Org/Mage-Flow
- Comfy-Org/Ming-Image
- Comfy-Org/MiniMax-H3-Image
- Comfy-Org/MOSS-Image
- Comfy-Org/NewBie-image-Exp0.1_repackaged
- Comfy-Org/Omnigen2_ComfyUI_repackaged124 unmodified lines - meituan-longcat/LongCat-Image
- microsoft/Lens
- microsoft/Lens-Turbo
- MiniMaxAI/MiniMax-H3-Image
- NewBie-AI/NewBie-image-Exp0.1
- nvidia/PiD
- nvidia/PixelDiT-1300M-1024px11 unmodified lines121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909125 unmodified lines1171181194612012112212319 unmodified lines1431441451461471481491501511521531541551561571581591601611621631641651667 unmodified lines17417517686871771781799018011 unmodified lines node['_meta']['title'] = title
return node
def _get_node_input_spec(class_type, input_name):
"""Fetch the raw input spec (``[type, config]``) for ``class_type.input_name``."""
# 1. ComfyUI /object_info backed manager (used by the standalone comfy-webui app)
try:
from comfy_webui_core import node_info_manager
node_info = node_info_manager.get_node_info(class_type)
if isinstance(node_info, dict):
inputs_cfg = node_info.get('input', {}) or {}
for category in ('required', 'optional'):
candidate = (inputs_cfg.get(category) or {}).get(input_name)
if candidate:
return candidate
except Exception:
pass
# 2. In-process ComfyUI node classes (used by the Hugging Face Spaces runtime)
try:
from comfy_integration.nodes import NODE_CLASS_MAPPINGS
node_class = NODE_CLASS_MAPPINGS.get(class_type)
if node_class is not None:
input_types = node_class.INPUT_TYPES() or {}
for category in ('required', 'optional'):
candidate = (input_types.get(category) or {}).get(input_name)
if candidate:
return candidate
except Exception:
pass
return None
def _get_autogrow_image_slot_names(assembler, target_node_id, input_name='images'):
"""
Resolve the real per-image slot key template for an Autogrow image input.
ComfyUI exposes two flavours of Autogrow template:
* TemplatePrefix(prefix="image_") -> names are 0-based: image_0, image_1, ...
* TemplateNames(names=["image_1", ...]) -> names start at image_1
Returns a list of slot names indexed from 0 (i.e. index i is the name for the i-th image),
or None when the node schema cannot be introspected.
"""
target_node = assembler.workflow.get(target_node_id)
if not isinstance(target_node, dict):
return None
class_type = target_node.get('class_type')
if not class_type:
return None
spec = _get_node_input_spec(class_type, input_name)
if not isinstance(spec, (list, tuple)) or len(spec) < 2 or not isinstance(spec[1], dict):
return None
template = spec[1].get('template')
if not isinstance(template, dict):
return None
names = template.get('names')
if isinstance(names, (list, tuple)) and names:
return [str(n) for n in names]
prefix = template.get('prefix')
if isinstance(prefix, str):
# TemplatePrefix is numbered from 0 in ComfyUI (range(self.max)).
max_count = template.get('max', 100)
if not isinstance(max_count, int) or max_count <= 0:
max_count = 100
return [f"{prefix}{i}" for i in range(max_count)]
return None
def inject(assembler, chain_definition, chain_items):
if not chain_items:
return25 unmodified lines target_node_id = assembler.node_map.get(target_node_name)
if not target_node_id or target_node_id not in assembler.workflow:
supported_types = ('TextEncodeMageFlowEdit', 'TextEncodeQwenImage21', 'TextEncodeBooguEdit', 'TextEncodeMingImageEdit', 'TextEncodeFibo2')
supported_types = ('TextEncodeMageFlowEdit', 'TextEncodeQwenImage21', 'TextEncodeBooguEdit', 'TextEncodeMingImageEdit', 'TextEncodeFibo2', 'MiniMaxH3ImageConditioning')
for node_id, node in assembler.workflow.items():
if isinstance(node, dict) and node.get('class_type') in supported_types:
target_node_id = node_id19 unmodified lines megapixels = chain_definition.get('megapixels', 1.0)
resolution_steps = chain_definition.get('resolution_steps', 1)
# Derive the node's real autogrow slot naming (0-based prefix vs 1-based names)
# instead of assuming image_1..image_N, which silently breaks 0-based nodes.
input_name = chain_definition.get('input_name', 'images')
slot_names = _get_autogrow_image_slot_names(assembler, target_node_id, input_name=input_name)
index_base = chain_definition.get('slot_index_base')
slot_key = None
for i, img_filename in enumerate(valid_images):
if slot_names is not None:
if i >= len(slot_names):
print(f"Warning: Reference Image chain reached the node's slot limit ({len(slot_names)}). Stopping.")
break
slot_key = f"{input_name}.{slot_names[i]}"
else:
# Fallback when node schema is unavailable: honor explicit chain config or use 1-based legacy default.
base = 1 if index_base is None else int(index_base)
slot_key = f"{input_name}.image_{i + base}"
load_id = assembler._get_unique_id()
load_node = create_node(assembler, "LoadImage", f"Load Reference Image {i+1}")
load_node['inputs']['image'] = img_filename7 unmodified lines scale_node['inputs']['image'] = [load_id, 0]
assembler.workflow[scale_id] = scale_node
input_key = f"images.image_{i+1}"
assembler.workflow[target_node_id]['inputs'][input_key] = [scale_id, 0]
assembler.workflow[target_node_id]['inputs'][slot_key] = [scale_id, 0]
node_class = assembler.workflow[target_node_id].get('class_type', 'Unknown')
print(f"Reference Image injector applied: {len(valid_images)} image(s) injected into '{target_node_id}' ({node_class}), max_images={max_images}.") print(f"Reference Image injector applied: {len(valid_images)} image(s) injected into '{target_node_id}' ({node_class}), max_images={max_images}, slots={slot_key or '-'}.")123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172nodes: unet_loader: class_type: UNETLoader title: "Load Diffusion Model" params: weight_dtype: "default" vae_loader: class_type: VAELoader title: "Load VAE" clip_loader: class_type: CLIPLoader title: "Load CLIP" params: type: "minimax" device: "default" prompt: class_type: MiniMaxH3ImageConditioning title: "MiniMax H3 Image Conditioning" params: width: 2048 height: 2048 negative_zero_out: class_type: ConditioningZeroOut title: "Conditioning Zero Out (Negative)"
connections: - from: "unet_loader:0" to: "ksampler:model" - from: "clip_loader:0" to: "prompt:clip" - from: "vae_loader:0" to: "prompt:vae" - from: "prompt:0" to: "ksampler:positive" - from: "prompt:0" to: "negative_zero_out:conditioning" - from: "negative_zero_out:0" to: "ksampler:negative" - from: "prompt:1" to: "ksampler:latent_image" - from: "vae_loader:0" to: "vae_decode:vae" - from: "vae_loader:0" to: "vae_encode:vae"
dynamic_lora_chains: lora_chain: template: "LoraLoader" output_map: "unet_loader:0": "model" "clip_loader:0": "clip" input_map: "model": "model" "clip": "clip" end_input_map: "model": ["ksampler:model"] "clip": ["prompt:clip"]
dynamic_reference_image_chains: reference_image_chain: text_encode_node: "prompt" vae_node: "vae_loader" max_images: 8
ui_map: positive_prompt: "prompt:prompt" negative_prompt: "dummy:negative_prompt" unet_name: "unet_loader:unet_name" clip_name: "clip_loader:clip_name" vae_name: "vae_loader:vae_name" width: "prompt:width" height: "prompt:height"12312345615 unmodified lines2223242525262728comfyui-frontend-package==1.57.1comfyui-workflow-templates==0.11.96comfyui-embedded-docs==0.5.14comfyui-frontend-package==1.58.5comfyui-workflow-templates==0.11.106comfyui-embedded-docs==0.5.16torchtorchsdetorchvision15 unmodified linesfilelockav>=17.0.0comfy-aimdo==0.6.0comfy-kitchen==0.2.40comfy-kitchen==0.2.41requestssimpleeval>=1.0.0blake3250 unmodified lines251252253254255256257258259260261262263264265266267268269270271250 unmodified lines required:
- image
minimax_h3_image_reference_edit:
chains: reference_image
display_name: "MiniMax-H3-Image Reference Edit"
description: "For MiniMax-H3-Image, this feature enables reference image editing and combining capabilities. In txt2img mode, adding a single reference image performs an Image Edit, while adding multiple images performs an Image Combine. The prompt refers to them as <Picture 1>, <Picture 2>, ..."
max_count: 8
usage_guideline: "Supply reference image(s) encoded as Base64 Data URI or HTTP/HTTPS URL (up to 8). Refer to them in the prompt as <Picture 1>, <Picture 2>, ...; <Picture 1> is the picture to edit."
parameters_schema:
type: object
properties:
image:
type: string
description: "Reference image encoded as Base64 Data URI or HTTP/HTTPS URL."
required:
- image
krea2_identity_edit:
chains: krea2_identity_edit
display_name: "KREA2 Identity Edit"23 unmodified lines242526272829303132333435363723 unmodified lines "3:4 (Classic Portrait)": [896, 1152]
"3:2 (Photography)": [1216, 832]
"2:3 (Photography Portrait)": [832, 1216]
minimax-h3-image:
"1:1 (Square)": [2048, 2048]
"16:9 (Landscape)": [2048, 1152]
"9:16 (Portrait)": [1152, 2048]
"4:3 (Classic)": [1792, 1344]
"3:4 (Classic Portrait)": [1344, 1792]
"3:2 (Photography)": [1920, 1280]
"2:3 (Photography Portrait)": [1280, 1920]
krea-2:
"1:1 (Square)": [1024, 1024]
"16:9 (Landscape)": [1344, 768]404 unmodified lines405406407408409410411412413414415559 unmodified lines975976977978979980981982983984985143 unmodified lines11291130113111321133113411351136113711381139404 unmodified lines repo_id: "comfyanonymous/ControlNet-v1-1_fp16_safetensors"
repository_file_path: "control_v11u_sd15_tile_fp16.safetensors"
diffusion_models:
# MiniMax-H3-Image
- filename: "minimax_h3_image_pruned_w4a8.safetensors"
source: "hf"
repo_id: "Comfy-Org/MiniMax-H3-Image"
repository_file_path: "diffusion_models/minimax_h3_image_pruned_w4a8.safetensors"
# Fibo 2.0
- filename: "fibo2_dev_int8_convrot.safetensors"
source: "hf"559 unmodified lines repo_id: "Comfy-Org/Qwen-Image-2.1"
repository_file_path: "model_patches/qwen_image_2.1_fun_controlnet_union_int8_convrot.safetensors"
text_encoders:
# MiniMax-H3-Image
- filename: "qwen3vl_32b_minimax_h3_nvfp4_awq.safetensors"
source: "hf"
repo_id: "Comfy-Org/MiniMax-H3-Image"
repository_file_path: "text_encoders/qwen3vl_32b_minimax_h3_nvfp4_awq.safetensors"
# MOSS-Image
- filename: "qwen3.5_9b_w4a8_gptq.safetensors"
source: "hf"143 unmodified lines repo_id: "Comfy-Org/Omnigen2_ComfyUI_repackaged"
repository_file_path: "split_files/text_encoders/qwen_2.5_vl_fp16.safetensors"
vae:
# MiniMax-H3-Image
- filename: "minimax_h3_image_vae_fp16.safetensors"
source: "hf"
repo_id: "Comfy-Org/MiniMax-H3-Image"
repository_file_path: "vae/minimax_h3_image_vae_fp16.safetensors"
- filename: "wan_2.1_vae.safetensors"
source: "hf"
repo_id: "Comfy-Org/Wan_2.1_ComfyUI_repackaged"11 unmodified lines121314151617181920212211 unmodified lines - flux3_prompt_upsampler - pid
minimax-h3-image: enabled_chains: - lora - reference_image
krea-2: enabled_chains: - lora12345637 unmodified lines4445464748495051architecture_order:
- "FLUX.3"
- "MiniMax-H3-Image"
- "Krea-2"
- "Qwen-Image-2.1"
- "Fibo-2.0"37 unmodified lines model_type: "fibo-2.0"
"FLUX.3":
model_type: "flux3"
"MiniMax-H3-Image":
model_type: "minimax-h3-image"
Krea-2:
model_type: "krea-2"
"SenseNova-U1.5":44 unmodified lines4546474849505152535455565744 unmodified lines sampler_name: "euler"
scheduler: "simple"
MiniMax-H3-Image:
_defaults:
steps: 6
cfg: 1.0
sampler_name: "euler"
scheduler: "simple"
Krea-2:
_defaults:
steps: 5216 unmodified lines171819202122232425262728293016 unmodified lines unet: "flux3-image-klein-base-nvfp4.safetensors"
clip: "qwen3vl_4b_fp8_scaled.safetensors"
vae: "flux2-vae.safetensors"
MiniMax-H3-Image:
latent_type: none
models:
- display_name: "MiniMaxAI/MiniMax-H3-Image"
components:
unet: "minimax_h3_image_pruned_w4a8.safetensors"
clip: "qwen3vl_32b_minimax_h3_nvfp4_awq.safetensors"
vae: "minimax_h3_image_vae_fp16.safetensors"
Krea-2:
latent_type: latent
models:README.md+2
chain_injectors/reference_image_injector.py+94-4
core/pipelines/workflow_recipes/_partials/conditioning/minimax-h3-image.yamlAdded+72
requirements.txt+4-4
yaml/chain_features.yaml+15
yaml/constants.yaml+8
yaml/file_list.yaml+15
yaml/model_architecture_features.yaml+5
yaml/model_architectures.yaml+3
yaml/model_defaults.yaml+7
yaml/model_list.yaml+8