Add Qwen-Image-2.1 architecture model.
Browse filesFiles changed (20)
- README.md+2
- chain_injectors/qwen_image_2_1_edit_injector.pyAdded+73
- core/pipelines/pipeline_input_processor.py+12
- core/pipelines/sd_image_pipeline.py+2
- core/pipelines/workflow_recipes/_partials/conditioning/qwen-image-2.1.yamlAdded+78
- requirements.txt+45-45
- ui/events/chain_handlers.py+33
- ui/events/change_handlers.py+4-2
- ui/events/main.py+9-3
- ui/events/run_handlers.py+3-1
- ui/imagegen_ui.py+2-1
- ui/shared/ui_components.py+29
- yaml/chain_features.yaml+15
- yaml/constants.yaml+9
- yaml/file_list.yaml+13
- yaml/model_architecture_features.yaml+5
- yaml/model_architectures.yaml+4
- yaml/model_defaults.yaml+8-1
- yaml/model_list.yaml+8
- yaml/task_features.yaml+5
56 unmodified lines57585960616263107 unmodified lines17117217317417517617756 unmodified lines - Comfy-Org/Ovis-Image
- Comfy-Org/PixelDiT
- Comfy-Org/Qwen-Image_ComfyUI
- Comfy-Org/Qwen-Image-2.1
- Comfy-Org/Qwen-Image-Edit_ComfyUI
- Comfy-Org/sigclip_vision_384
- Comfy-Org/stable-diffusion-3.5-fp8107 unmodified lines - OmniGen2/OmniGen2
- Qwen/Qwen-Image
- Qwen/Qwen-Image-2512
- Qwen/Qwen-Image-2.1
- Qwen/Qwen-Image-Edit
- Qwen/Qwen-Image-Edit-2509
- Qwen/Qwen-Image-Edit-251112345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273def create_node(assembler, class_type, title): try: node = assembler._get_node_template(class_type) except Exception: node = { "inputs": {}, "class_type": class_type, "_meta": {"title": title} } node['_meta']['title'] = title return node
def inject(assembler, chain_definition, chain_items): if not chain_items: return
valid_images = [] for item in chain_items: if not item: continue img_path = item if isinstance(item, dict): img_path = item.get('image') or item.get('filename') or item.get('path') if img_path: valid_images.append(img_path)
if not valid_images: return
valid_images = valid_images[:10]
prompt_name = chain_definition.get('prompt_node', 'prompt') vae_loader_name = chain_definition.get('vae_loader_node', 'vae_loader')
prompt_id = assembler.node_map.get(prompt_name) if not prompt_id or prompt_id not in assembler.workflow: for node_id, node in assembler.workflow.items(): if isinstance(node, dict) and node.get('class_type') == 'TextEncodeQwenImage21': prompt_id = node_id break
if not prompt_id: print(f"Warning: Target node '{prompt_name}' (TextEncodeQwenImage21) for Qwen-Image-2.1 Edit chain not found. Skipping.") return
vae_id = assembler.node_map.get(vae_loader_name) if not vae_id: for node_id, node in assembler.workflow.items(): if isinstance(node, dict) and node.get('class_type') == 'VAELoader': vae_id = node_id break
if vae_id: assembler.workflow[prompt_id]['inputs']['vae'] = [vae_id, 0]
for i, img_filename in enumerate(valid_images): load_id = assembler._get_unique_id() load_node = create_node(assembler, "LoadImage", f"Load Reference Image {i+1}") load_node['inputs']['image'] = img_filename assembler.workflow[load_id] = load_node
scale_id = assembler._get_unique_id() scale_node = create_node(assembler, "ImageScaleToTotalPixels", f"Scale Reference {i+1}") scale_node['inputs']['upscale_method'] = "nearest-exact" scale_node['inputs']['megapixels'] = 1 scale_node['inputs']['resolution_steps'] = 1 scale_node['inputs']['image'] = [load_id, 0] assembler.workflow[scale_id] = scale_node
image_key = f"images.image_{i+1}" assembler.workflow[prompt_id]['inputs'][image_key] = [scale_id, 0]
print(f"Qwen-Image-2.1 Edit injector applied with {len(valid_images)} reference image(s). Connected VAE dynamically.")422 unmodified lines42342442542642742842943043143243343443543643743843957 unmodified lines497498499500501502503422 unmodified lines temp_files_to_clean.append(temp_path)
active_boogu_edit.append(os.path.basename(temp_path))
qwen_image_2_1_edit_data = ui_inputs.get('qwen_image_2_1_edit_data', [])
active_qwen_image_2_1_edit = []
if 'qwen_image_2_1_edit' in enabled_chains and qwen_image_2_1_edit_data:
for img in qwen_image_2_1_edit_data:
if img:
if not os.path.exists(INPUT_DIR): os.makedirs(INPUT_DIR)
temp_path = os.path.join(INPUT_DIR, f"temp_qwen21_edit_ref_{random.randint(1000, 9999)}.png")
img.save(temp_path, "PNG")
temp_files_to_clean.append(temp_path)
active_qwen_image_2_1_edit.append(os.path.basename(temp_path))
reference_image_data = ui_inputs.get('reference_image_data', [])
active_reference_images = []
if 'reference_image' in enabled_chains and reference_image_data:57 unmodified lines "active_krea2_identity_edit": active_krea2_identity_edit,
"active_krea2_reference_edit": active_krea2_reference_edit,
"active_qwen_image_edit": active_qwen_image_edit,
"active_qwen_image_2_1_edit": active_qwen_image_2_1_edit,
"active_boogu_edit": active_boogu_edit,
"active_reference_images": active_reference_images,
"active_conditioning": active_conditioning,119 unmodified lines12012112212312412512656 unmodified lines183184185186187188189119 unmodified lines active_krea2_identity_edit = processed.get("active_krea2_identity_edit", [])
active_krea2_reference_edit = processed.get("active_krea2_reference_edit", [])
active_qwen_image_edit = processed.get("active_qwen_image_edit", [])
active_qwen_image_2_1_edit = processed.get("active_qwen_image_2_1_edit", [])
active_boogu_edit = processed.get("active_boogu_edit", [])
active_reference_images = processed.get("active_reference_images", [])
active_conditioning = processed["active_conditioning"]56 unmodified lines "krea2_identity_edit_chain": active_krea2_identity_edit,
"krea2_style_reference_chain": active_krea2_reference_edit,
"qwen_image_edit_chain": active_qwen_image_edit,
"qwen_image_2_1_edit_chain": active_qwen_image_2_1_edit,
"boogu_image_edit_chain": active_boogu_edit,
"reference_image_chain": active_reference_images,
"vae_chain": [ui_inputs.get('vae_name')] if (ui_inputs.get('vae_name') and 'vae' in enabled_chains) else [],123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778nodes: prompt: class_type: TextEncodeQwenImage21 title: "Text Encode Qwen Image 2.1" params: resolution: 1024 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: "qwen_image" device: "default"
connections: - from: "unet_loader:0" to: "ksampler:model"
- from: "clip_loader:0" to: "prompt:clip"
- from: "vae_loader:0" to: "vae_decode:vae" - from: "vae_loader:0" to: "vae_encode:vae"
- from: "prompt:0" to: "ksampler:positive" - from: "prompt:1" to: "ksampler:negative"
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_controlnet_chains: controlnet_chain: template: "ControlNetApplyAdvanced" ksampler_node: "ksampler" vae_source: "vae_loader:0"
dynamic_conditioning_chains: conditioning_chain: ksampler_node: "ksampler" clip_source: "clip_loader:0"
dynamic_pid_chains: pid_chain: ksampler_node: "ksampler"
dynamic_qwen_image_2_1_edit_chains: qwen_image_2_1_edit_chain: prompt_node: "prompt" vae_loader_node: "vae_loader"
ui_map: positive_prompt: "prompt:prompt" negative_prompt: "prompt:negative_prompt" unet_name: "unet_loader:unet_name" vae_name: "vae_loader:vae_name" clip_name: "clip_loader:clip_name" scheduler_width: "prompt:resolution"12345678910111213141516171819202122232425262728293031323334353637383940414243444512345678910111213141516171819202122232425262728293031323334353637383940414243444546comfyui-frontend-package==1.52.7
comfyui-workflow-templates==0.11.62
comfyui-embedded-docs==0.5.11
torch
torchsde
torchvision
torchaudio
numpy>=1.25.0
einops
transformers>=4.50.3
tokenizers>=0.13.3
sentencepiece
safetensors>=0.4.2
aiohttp>=3.11.8
yarl>=1.18.0
pyyaml
Pillow
scipy
tqdm
psutil
alembic
SQLAlchemy>=2.0.0
filelock
av>=17.0.0
comfy-kitchen==0.2.34
comfy-aimdo==0.5.5
requests
simpleeval>=1.0.0
blake3
#non essential dependencies:
kornia>=0.7.1
spandrel
pydantic~=2.0
pydantic-settings~=2.0
PyOpenGL>=3.1.8
comfy-angle
diffusers
protobuf
insightface
huggingface-hub
imageio
spaces
comfyui-frontend-package==1.53.6comfyui-workflow-templates==0.11.66comfyui-embedded-docs==0.5.12torchtorchsdetorchvisiontorchaudionumpy>=1.25.0einopstransformers>=4.50.3tokenizers>=0.13.3sentencepiecesafetensors>=0.4.2aiohttp>=3.11.8yarl>=1.18.0pyyamlPillowscipytqdmpsutilalembicSQLAlchemy>=2.0.0filelockav>=17.0.0comfy-kitchen==0.2.35comfy-aimdo==0.5.5requestssimpleeval>=1.0.0blake3
#non essential dependencies:kornia>=0.7.1spandrelpydantic~=2.0pydantic-settings~=2.0PyOpenGL>=3.1.8comfy-angle
diffusersprotobufinsightfacehuggingface-hubimageiospacessageattention @ https://huggingface.co/RioShiina/Sage-Attention-ZeroGPU-Space-Build/resolve/main/sageattention-2.2.0-cp312-cp312-linux_x86_64.whl998 unmodified lines99910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037998 unmodified lines del_button = ui_components[f'delete_boogu_edit_button_{prefix}']
images = ui_components[f'boogu_edit_images_{prefix}']
def add_ref_row(c):
c += 1
return {
count_state: c,
ref_rows[c - 1]: gr.update(visible=True),
add_button: gr.update(visible=c < max_units),
del_button: gr.update(visible=True),
}
def del_ref_row(c):
c -= 1
return {
count_state: c,
ref_rows[c]: gr.update(visible=False),
images[c]: None,
add_button: gr.update(visible=True),
del_button: gr.update(visible=c > 1),
}
add_outputs = [count_state, add_button, del_button] + ref_rows
del_outputs = [count_state, add_button, del_button] + ref_rows + images
add_button.click(fn=add_ref_row, inputs=[count_state], outputs=add_outputs, show_progress=False)
del_button.click(fn=del_ref_row, inputs=[count_state], outputs=del_outputs, show_progress=False)
def create_qwen_image_2_1_edit_event_handlers(prefix, ui_components, max_units=10):
ref_rows = ui_components.get(f'qwen_image_2_1_edit_rows_{prefix}')
if not ref_rows: return
count_state = ui_components[f'qwen_image_2_1_edit_count_state_{prefix}']
add_button = ui_components[f'add_qwen_image_2_1_edit_button_{prefix}']
del_button = ui_components[f'delete_qwen_image_2_1_edit_button_{prefix}']
images = ui_components[f'qwen_image_2_1_edit_images_{prefix}']
def add_ref_row(c):
c += 1
return {17 unmodified lines181920212122232462 unmodified lines8788899091929365 unmodified lines15916016116116216316416570 unmodified lines23623723823924024124217 unmodified lines load_ipadapter_config
)
def make_update_fn(m_comp, cat_comp, ar_comp, width_comp, height_comp, cn_types, cn_series, cn_filepaths, anima_cn_types, anima_cn_series, anima_cn_filepaths, diffsynth_cn_types, diffsynth_cn_series, diffsynth_cn_filepaths, krea2_cn_types, krea2_cn_series, krea2_cn_filepaths, ipa_preset, lora_acc, cn_acc, anima_cn_acc, diffsynth_cn_acc, krea2_cn_acc, ipa_acc, sd3_ipa_acc, flux1_ipa_acc, style_acc, embed_acc, cond_acc, ref_latent_acc, hidream_o1_ref_acc, prompt_comp, neg_prompt_comp, steps_comp, cfg_comp, sampler_comp, scheduler_comp, pid_acc=None, vae_acc=None, joyai_ref_acc=None, krea2_identity_edit_acc=None, krea2_reference_edit_acc=None, qwen_image_edit_acc=None, boogu_edit_acc=None, ref_img_acc=None, sensenova_ref_acc=None, task_type=None, type_comp=None):
def make_update_fn(m_comp, cat_comp, ar_comp, width_comp, height_comp, cn_types, cn_series, cn_filepaths, anima_cn_types, anima_cn_series, anima_cn_filepaths, diffsynth_cn_types, diffsynth_cn_series, diffsynth_cn_filepaths, krea2_cn_types, krea2_cn_series, krea2_cn_filepaths, ipa_preset, lora_acc, cn_acc, anima_cn_acc, diffsynth_cn_acc, krea2_cn_acc, ipa_acc, sd3_ipa_acc, flux1_ipa_acc, style_acc, embed_acc, cond_acc, ref_latent_acc, hidream_o1_ref_acc, prompt_comp, neg_prompt_comp, steps_comp, cfg_comp, sampler_comp, scheduler_comp, pid_acc=None, vae_acc=None, joyai_ref_acc=None, krea2_identity_edit_acc=None, krea2_reference_edit_acc=None, qwen_image_edit_acc=None, qwen_image_2_1_edit_acc=None, boogu_edit_acc=None, ref_img_acc=None, sensenova_ref_acc=None, task_type=None, type_comp=None):
def update_fn(*args):
arch = args[0]
category = args[1]62 unmodified lines if krea2_identity_edit_acc: updates[krea2_identity_edit_acc] = gr.update(visible=('krea2_identity_edit' in enabled_chains))
if krea2_reference_edit_acc: updates[krea2_reference_edit_acc] = gr.update(visible=('krea2_style_reference' in enabled_chains))
if qwen_image_edit_acc: updates[qwen_image_edit_acc] = gr.update(visible=('qwen_image_edit' in enabled_chains))
if qwen_image_2_1_edit_acc: updates[qwen_image_2_1_edit_acc] = gr.update(visible=('qwen_image_2_1_edit' in enabled_chains))
if boogu_edit_acc: updates[boogu_edit_acc] = gr.update(visible=('boogu_image_edit' in enabled_chains))
if ref_img_acc: updates[ref_img_acc] = gr.update(visible=('reference_image' in enabled_chains))
if pid_acc: updates[pid_acc] = gr.update(visible=('pid' in enabled_chains))65 unmodified lines return update_fn
def make_model_change_fn(cat_comp_ref, ar_comp, width_comp, height_comp, cn_types, cn_series, cn_filepaths, anima_cn_types, anima_cn_series, anima_cn_filepaths, diffsynth_cn_types, diffsynth_cn_series, diffsynth_cn_filepaths, krea2_cn_types, krea2_cn_series, krea2_cn_filepaths, arch_comp_ref, ipa_preset, lora_acc, cn_acc, anima_cn_acc, diffsynth_cn_acc, krea2_cn_acc, ipa_acc, sd3_ipa_acc, flux1_ipa_acc, style_acc, embed_acc, cond_acc, ref_latent_acc, hidream_o1_ref_acc, prompt_comp, neg_prompt_comp, steps_comp, cfg_comp, sampler_comp, scheduler_comp, pid_acc=None, vae_acc=None, joyai_ref_acc=None, krea2_identity_edit_acc=None, krea2_reference_edit_acc=None, qwen_image_edit_acc=None, boogu_edit_acc=None, ref_img_acc=None, sensenova_ref_acc=None, task_type=None, type_comp=None):
def make_model_change_fn(cat_comp_ref, ar_comp, width_comp, height_comp, cn_types, cn_series, cn_filepaths, anima_cn_types, anima_cn_series, anima_cn_filepaths, diffsynth_cn_types, diffsynth_cn_series, diffsynth_cn_filepaths, krea2_cn_types, krea2_cn_series, krea2_cn_filepaths, arch_comp_ref, ipa_preset, lora_acc, cn_acc, anima_cn_acc, diffsynth_cn_acc, krea2_cn_acc, ipa_acc, sd3_ipa_acc, flux1_ipa_acc, style_acc, embed_acc, cond_acc, ref_latent_acc, hidream_o1_ref_acc, prompt_comp, neg_prompt_comp, steps_comp, cfg_comp, sampler_comp, scheduler_comp, pid_acc=None, vae_acc=None, joyai_ref_acc=None, krea2_identity_edit_acc=None, krea2_reference_edit_acc=None, qwen_image_edit_acc=None, qwen_image_2_1_edit_acc=None, boogu_edit_acc=None, ref_img_acc=None, sensenova_ref_acc=None, task_type=None, type_comp=None):
def change_fn(*args):
model_name = args[0]
idx = 170 unmodified lines if krea2_identity_edit_acc: updates[krea2_identity_edit_acc] = gr.update(visible=('krea2_identity_edit' in enabled_chains))
if krea2_reference_edit_acc: updates[krea2_reference_edit_acc] = gr.update(visible=('krea2_style_reference' in enabled_chains))
if qwen_image_edit_acc: updates[qwen_image_edit_acc] = gr.update(visible=('qwen_image_edit' in enabled_chains))
if qwen_image_2_1_edit_acc: updates[qwen_image_2_1_edit_acc] = gr.update(visible=('qwen_image_2_1_edit' in enabled_chains))
if boogu_edit_acc: updates[boogu_edit_acc] = gr.update(visible=('boogu_image_edit' in enabled_chains))
if ref_img_acc: updates[ref_img_acc] = gr.update(visible=('reference_image' in enabled_chains))
if pid_acc: updates[pid_acc] = gr.update(visible=('pid' in enabled_chains))17 unmodified lines1819202122232454 unmodified lines7980818283848536 unmodified lines12212312412512612712810 unmodified lines13914014113914214314414531 unmodified lines17717817918018118218315 unmodified lines19920020119820220320420518 unmodified lines22422522622722822923064 unmodified lines29529629729829930030132 unmodified lines33433533633133733833934017 unmodified lines create_krea2_identity_edit_event_handlers,
create_krea2_reference_edit_event_handlers,
create_qwen_image_edit_event_handlers,
create_qwen_image_2_1_edit_event_handlers,
create_boogu_edit_event_handlers,
create_reference_image_event_handlers
)54 unmodified lines krea2_identity_edit_accordion = ui_components.get(f'krea2_identity_edit_accordion_{prefix}')
krea2_reference_edit_accordion = ui_components.get(f'krea2_reference_edit_accordion_{prefix}')
qwen_image_edit_accordion = ui_components.get(f'qwen_image_edit_accordion_{prefix}')
qwen_image_2_1_edit_accordion = ui_components.get(f'qwen_image_2_1_edit_accordion_{prefix}')
boogu_edit_accordion = ui_components.get(f'boogu_edit_accordion_{prefix}')
ref_img_accordion = ui_components.get(f'reference_image_accordion_{prefix}')
pid_accordion = ui_components.get(f'pid_accordion_{prefix}')36 unmodified lines if krea2_identity_edit_accordion: outputs.append(krea2_identity_edit_accordion)
if krea2_reference_edit_accordion: outputs.append(krea2_reference_edit_accordion)
if qwen_image_edit_accordion: outputs.append(qwen_image_edit_accordion)
if qwen_image_2_1_edit_accordion: outputs.append(qwen_image_2_1_edit_accordion)
if boogu_edit_accordion: outputs.append(boogu_edit_accordion)
if ref_img_accordion: outputs.append(ref_img_accordion)
if pid_accordion: outputs.append(pid_accordion)10 unmodified lines krea2_cn_types_list, krea2_cn_series_list, krea2_cn_filepaths_list,
ipa_preset_list, lora_accordion, cn_accordion, anima_cn_accordion, diffsynth_cn_accordion, krea2_cn_accordion, ipa_accordion, sd3_ipa_accordion, flux1_ipa_accordion, style_accordion, embedding_accordion, conditioning_accordion,
ref_latent_accordion, hidream_o1_ref_accordion, prompt_comp, neg_prompt_comp, steps_comp, cfg_comp, sampler_comp, scheduler_comp,
pid_acc=pid_accordion, vae_acc=vae_accordion, joyai_ref_acc=joyai_ref_accordion, krea2_identity_edit_acc=krea2_identity_edit_accordion, krea2_reference_edit_acc=krea2_reference_edit_accordion, qwen_image_edit_acc=qwen_image_edit_accordion, boogu_edit_acc=boogu_edit_accordion, ref_img_acc=ref_img_accordion, sensenova_ref_acc=sensenova_ref_accordion,
pid_acc=pid_accordion, vae_acc=vae_accordion, joyai_ref_acc=joyai_ref_accordion, krea2_identity_edit_acc=krea2_identity_edit_accordion, krea2_reference_edit_acc=krea2_reference_edit_accordion, qwen_image_edit_acc=qwen_image_edit_accordion, qwen_image_2_1_edit_acc=qwen_image_2_1_edit_accordion, boogu_edit_acc=boogu_edit_accordion, ref_img_acc=ref_img_accordion, sensenova_ref_acc=sensenova_ref_accordion,
task_type=task_type, type_comp=type_comp
)
inputs = [arch_comp, cat_comp]31 unmodified lines if krea2_identity_edit_accordion: outputs2.append(krea2_identity_edit_accordion)
if krea2_reference_edit_accordion: outputs2.append(krea2_reference_edit_accordion)
if qwen_image_edit_accordion: outputs2.append(qwen_image_edit_accordion)
if qwen_image_2_1_edit_accordion: outputs2.append(qwen_image_2_1_edit_accordion)
if boogu_edit_accordion: outputs2.append(boogu_edit_accordion)
if ref_img_accordion: outputs2.append(ref_img_accordion)
if pid_accordion: outputs2.append(pid_accordion)15 unmodified lines krea2_cn_types_list, krea2_cn_series_list, krea2_cn_filepaths_list,
arch_comp, ipa_preset_list, lora_accordion, cn_accordion, anima_cn_accordion, diffsynth_cn_accordion, krea2_cn_accordion, ipa_accordion, sd3_ipa_accordion, flux1_ipa_accordion, style_accordion, embedding_accordion, conditioning_accordion,
ref_latent_accordion, hidream_o1_ref_accordion, prompt_comp, neg_prompt_comp, steps_comp, cfg_comp, sampler_comp, scheduler_comp,
pid_acc=pid_accordion, vae_acc=vae_accordion, joyai_ref_acc=joyai_ref_accordion, krea2_identity_edit_acc=krea2_identity_edit_accordion, krea2_reference_edit_acc=krea2_reference_edit_accordion, qwen_image_edit_acc=qwen_image_edit_accordion, boogu_edit_acc=boogu_edit_accordion, ref_img_acc=ref_img_accordion, sensenova_ref_acc=sensenova_ref_accordion,
pid_acc=pid_accordion, vae_acc=vae_accordion, joyai_ref_acc=joyai_ref_accordion, krea2_identity_edit_acc=krea2_identity_edit_accordion, krea2_reference_edit_acc=krea2_reference_edit_accordion, qwen_image_edit_acc=qwen_image_edit_accordion, qwen_image_2_1_edit_acc=qwen_image_2_1_edit_accordion, boogu_edit_acc=boogu_edit_accordion, ref_img_acc=ref_img_accordion, sensenova_ref_acc=sensenova_ref_accordion,
task_type=task_type, type_comp=type_comp
)
if type_comp:18 unmodified lines create_krea2_identity_edit_event_handlers(prefix, ui_components)
create_krea2_reference_edit_event_handlers(prefix, ui_components)
create_qwen_image_edit_event_handlers(prefix, ui_components)
create_qwen_image_2_1_edit_event_handlers(prefix, ui_components)
create_boogu_edit_event_handlers(prefix, ui_components)
create_reference_image_event_handlers(prefix, ui_components)
create_run_event(prefix, task_type, ui_components)64 unmodified lines f'krea2_identity_edit_accordion_{prefix}': 'krea2_identity_edit',
f'krea2_reference_edit_accordion_{prefix}': 'krea2_style_reference',
f'qwen_image_edit_accordion_{prefix}': 'qwen_image_edit',
f'qwen_image_2_1_edit_accordion_{prefix}': 'qwen_image_2_1_edit',
f'boogu_edit_accordion_{prefix}': 'boogu_image_edit',
f'reference_image_accordion_{prefix}': 'reference_image',
f'pid_accordion_{prefix}': 'pid',32 unmodified lines 'conditioning_accordion_imagegen', 'reference_latent_accordion_imagegen',
'hidream_o1_reference_accordion_imagegen', 'sensenova_reference_accordion_imagegen', 'joyai_reference_accordion_imagegen',
'krea2_identity_edit_accordion_imagegen', 'krea2_reference_edit_accordion_imagegen',
'qwen_image_edit_accordion_imagegen', 'boogu_edit_accordion_imagegen',
'qwen_image_edit_accordion_imagegen', 'qwen_image_2_1_edit_accordion_imagegen', 'boogu_edit_accordion_imagegen',
'reference_image_accordion_imagegen', 'pid_accordion_imagegen', 'vae_accordion_imagegen',
]
for key in accordion_keys:86 unmodified lines878889909192936 unmodified lines10010110210210310410510628 unmodified lines13513613713813914014186 unmodified lines krea2_identity_edit_data_components = ui_components.get(f'all_krea2_identity_edit_components_flat_{prefix}', [])
krea2_reference_edit_data_components = ui_components.get(f'all_krea2_reference_edit_components_flat_{prefix}', [])
qwen_image_edit_data_components = ui_components.get(f'all_qwen_image_edit_components_flat_{prefix}', [])
qwen_image_2_1_edit_data_components = ui_components.get(f'all_qwen_image_2_1_edit_components_flat_{prefix}', [])
boogu_edit_data_components = ui_components.get(f'all_boogu_edit_components_flat_{prefix}', [])
reference_image_data_components = ui_components.get(f'all_reference_image_components_flat_{prefix}', [])
6 unmodified lines all_chains = [
lora_data_components, controlnet_data_components, anima_controlnet_lllite_data_components, diffsynth_controlnet_data_components, krea2_controlnet_data_components, ipadapter_data_components,
sd3_ipadapter_data_components, flux1_ipadapter_data_components, style_data_components,
embedding_data_components, conditioning_data_components, reference_latent_data_components, hidream_o1_reference_data_components, sensenova_reference_data_components, joyai_reference_data_components, krea2_identity_edit_data_components, krea2_reference_edit_data_components, qwen_image_edit_data_components, boogu_edit_data_components, reference_image_data_components
embedding_data_components, conditioning_data_components, reference_latent_data_components, hidream_o1_reference_data_components, sensenova_reference_data_components, joyai_reference_data_components, krea2_identity_edit_data_components, krea2_reference_edit_data_components, qwen_image_edit_data_components, qwen_image_2_1_edit_data_components, boogu_edit_data_components, reference_image_data_components
]
for chain in all_chains:
if chain:28 unmodified lines assign_chain_data('krea2_identity_edit_data', krea2_identity_edit_data_components)
assign_chain_data('krea2_reference_edit_data', krea2_reference_edit_data_components)
assign_chain_data('qwen_image_edit_data', qwen_image_edit_data_components)
assign_chain_data('qwen_image_2_1_edit_data', qwen_image_2_1_edit_data_components)
assign_chain_data('boogu_edit_data', boogu_edit_data_components)
assign_chain_data('reference_image_data', reference_image_data_components)
7 unmodified lines89101111121314174 unmodified lines1891901911921931941957 unmodified lines create_conditioning_ui, create_vae_override_ui, create_model_architecture_filter_ui, create_category_filter_ui, create_sd3_ipadapter_ui, create_flux1_ipadapter_ui, create_style_ui, create_reference_latent_ui, create_hidream_o1_reference_ui, create_sensenova_reference_ui, create_joyai_reference_ui, create_reference_image_ui, create_krea2_identity_edit_ui, create_krea2_reference_edit_ui, create_qwen_image_edit_ui, create_boogu_edit_ui, create_reference_latent_ui, create_hidream_o1_reference_ui, create_sensenova_reference_ui, create_joyai_reference_ui, create_reference_image_ui, create_krea2_identity_edit_ui, create_krea2_reference_edit_ui, create_qwen_image_edit_ui, create_qwen_image_2_1_edit_ui, create_boogu_edit_ui, create_pid_ui)
174 unmodified lines components.update(create_krea2_identity_edit_ui(prefix)) components.update(create_krea2_reference_edit_ui(prefix)) components.update(create_qwen_image_edit_ui(prefix)) components.update(create_qwen_image_2_1_edit_ui(prefix)) components.update(create_boogu_edit_ui(prefix)) components.update(create_reference_image_ui(prefix)) components.update(create_vae_override_ui(prefix))910 unmodified lines911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943910 unmodified lines
components[key('all_boogu_edit_components_flat')] = ref_image_inputs
return components
def create_qwen_image_2_1_edit_ui(prefix: str, max_units=10):
components = {}
key = lambda name: f"{name}_{prefix}"
with gr.Accordion("Qwen-Image-2.1 Edit Settings", open=False, visible=('qwen_image_2_1_edit' in default_enabled_chains)) as ref_accordion:
components[key('qwen_image_2_1_edit_accordion')] = ref_accordion
gr.Markdown("💡 **Tip:** For Qwen-Image-2.1 models, 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**.")
ref_image_groups = []
ref_image_inputs = []
with gr.Row():
for i in range(max_units):
with gr.Column(visible=(i < 1), min_width=160) as img_col:
img_comp = gr.Image(type="pil", label=f"Ref. {i+1}", sources=["upload"], height=150)
ref_image_groups.append(img_col)
ref_image_inputs.append(img_comp)
components[key('qwen_image_2_1_edit_rows')] = ref_image_groups
components[key('qwen_image_2_1_edit_images')] = ref_image_inputs
with gr.Row():
components[key('add_qwen_image_2_1_edit_button')] = gr.Button("✚ Add Reference Image")
components[key('delete_qwen_image_2_1_edit_button')] = gr.Button("➖ Delete Reference Image", visible=False)
components[key('qwen_image_2_1_edit_count_state')] = gr.State(1)
components[key('all_qwen_image_2_1_edit_components_flat')] = ref_image_inputs
return components337 unmodified lines338339340341342343344345346347348349350351352353354355356357358337 unmodified lines required:
- image
qwen_image_2_1_edit:
chains: qwen_image_2_1_edit
display_name: "Qwen-Image-2.1 Edit"
description: "For Qwen-Image-2.1 models, 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."
max_count: 10
usage_guideline: "Supply reference image(s) (up to 10) encoded as Base64 Data URI or HTTP/HTTPS URL. Passing reference image(s) scales them to 1MP via nearest-exact method and feeds them dynamically into TextEncodeQwenImage21."
parameters_schema:
type: object
properties:
image:
type: string
description: "Reference image encoded as Base64 Data URI or HTTP/HTTPS URL."
required:
- image
hidream_o1_smoothing:
chains: hidream_o1_smoothing
display_name: "HiDream O1 Smoothing Injector"102 unmodified lines103104105106107108109110111112113114115116176 unmodified lines293294295296297298299102 unmodified lines "3:4 (Classic Portrait)": [896, 1152]
"3:2 (Photography)": [1216, 832]
"2:3 (Photography Portrait)": [832, 1216]
qwen-image-2.1:
"1:1 (Square)": [1024, 1024]
"16:9 (Landscape)": [1344, 768]
"9:16 (Portrait)": [768, 1344]
"4:3 (Classic)": [1152, 896]
"3:4 (Classic Portrait)": [896, 1152]
"3:2 (Photography)": [1216, 832]
"2:3 (Photography Portrait)": [832, 1216]
qwen-image:
"1:1 (Square)": [1328, 1328]
"16:9 (Landscape)": [1664, 928]176 unmodified lines flux2: 1
ernie-image: 1
z-image: 1
qwen-image-2.1: 1
qwen-image: 1
longcat-image: 1
cosmos-predict2: 1636 unmodified lines637638639640641642643644645646647358 unmodified lines10061007100810091010101110121013101410153 unmodified lines1019102010211022102310241025102610271028636 unmodified lines source: "hf"
repo_id: "Comfy-Org/z_image"
repository_file_path: "split_files/diffusion_models/z_image_bf16.safetensors"
# Qwen-Image-2.1
- filename: "qwen_image_2.1_int8_convrot.safetensors"
source: "hf"
repo_id: "Comfy-Org/Qwen-Image-2.1"
repository_file_path: "diffusion_models/qwen_image_2.1_int8_convrot.safetensors"
# Qwen-Image
- filename: "qwen_image_2512_fp8_e4m3fn_scaled_comfyui_4steps_v1.0.safetensors"
source: "hf"358 unmodified lines source: "hf"
repo_id: "Comfy-Org/Omnigen2_ComfyUI_repackaged"
repository_file_path: "split_files/text_encoders/qwen_2.5_vl_fp16.safetensors"
- filename: "qwen3vl_8b_w4a8.safetensors"
source: "hf"
repo_id: "Comfy-Org/Qwen-Image-2.1"
repository_file_path: "text_encoders/qwen3vl_8b_w4a8.safetensors"
vae:
- filename: "wan_2.1_vae.safetensors"
source: "hf"3 unmodified lines source: "hf"
repo_id: "Comfy-Org/Qwen-Image_ComfyUI"
repository_file_path: "split_files/vae/qwen_image_vae.safetensors"
- filename: "qwen_image_2.1_vae_bf16.safetensors"
source: "hf"
repo_id: "Comfy-Org/Qwen-Image-2.1"
repository_file_path: "vae/qwen_image_2.1_vae_bf16.safetensors"
- filename: "hunyuan_image_2.1_vae_fp16.safetensors"
source: "hf"
repo_id: "Comfy-Org/HunyuanImage_2.1_ComfyUI"69 unmodified lines707172737475767778798069 unmodified lines - vae - pid
qwen-image-2.1: enabled_chains: - lora - qwen_image_2_1_edit
qwen-image: enabled_chains: - lora12345655 unmodified lines626364656667686970architecture_order:
- "Krea-2"
- "Qwen-Image-2.1"
- "SenseNova-U1.5"
- "Mage-Flow"
- "JoyAI-Image"55 unmodified lines "Z-Image":
model_type: "z-image"
controlnet_key: "Z-Image"
"Qwen-Image-2.1":
model_type: "qwen-image-2.1"
controlnet_key: "Qwen-Image"
"Qwen-Image":
model_type: "qwen-image"
controlnet_key: "Qwen-Image"130 unmodified lines13113213313413513613713813914014114214388 unmodified lines232233234228235236237238130 unmodified lines steps: 9
cfg: 1.0
Qwen-Image-2.1:
_defaults:
steps: 25
cfg: 1.0
sampler_name: "euler"
scheduler: "simple"
Qwen-Image:
_defaults:
steps: 2088 unmodified lines scheduler: "normal"
positive_prompt: "masterpiece, best quality, score_9, score_8, score_7, year 2025, newest, highres, absurdres, very aesthetic, scenery, safe, "
negative_prompt: "worst quality, low quality, early, old, score_1, score_2, score_3, cartoon, graphic, painting, crayon, graphite, abstract, glitch, deformed, mutated, ugly, disfigured, long body, bad anatomy, bad hands, missing fingers, extra fingers, extra digits, fewer digits, cropped, very displeasing, artist name, blurry, jpeg artifacts, lowres, censor"
"RAMTHRUST/RAMTHRUST'S-NSFW-PINK-ALCHEMY-ANIMA-v3.1":
"Crody/RAMTHRUST'S-NSFW-PINK-ALCHEMY-ANIMA-v3.1":
steps: 35
cfg: 4.5
sampler_name: "er_sde"11 unmodified lines121314151617181920212223242511 unmodified lines unet: "krea2_raw-nvfp4.safetensors"
clip: "qwen3vl_4b_fp8_scaled.safetensors"
vae: "qwen_image_vae.safetensors"
Qwen-Image-2.1:
latent_type: latent
models:
- display_name: "Qwen-Image-2.1"
components:
unet: "qwen_image_2.1_int8_convrot.safetensors"
vae: "qwen_image_2.1_vae_bf16.safetensors"
clip: "qwen3vl_8b_w4a8.safetensors"
SenseNova-U1.5:
latent_type: hidream_o1_latent
models:23 unmodified lines2425262728293020 unmodified lines5152535455565719 unmodified lines7778798081828319 unmodified lines10310410510610710810919 unmodified lines12913013113213313413523 unmodified lines - krea2_identity_edit - krea2_style_reference - qwen_image_edit - qwen_image_2_1_edit - boogu_image_edit - reference_image - pid20 unmodified lines - krea2_identity_edit - krea2_style_reference - qwen_image_edit - qwen_image_2_1_edit - boogu_image_edit - reference_image - vae19 unmodified lines - krea2_identity_edit - krea2_style_reference - qwen_image_edit - qwen_image_2_1_edit - boogu_image_edit - reference_image - vae19 unmodified lines - krea2_identity_edit - krea2_style_reference - qwen_image_edit - qwen_image_2_1_edit - boogu_image_edit - reference_image - vae19 unmodified lines - krea2_identity_edit - krea2_style_reference - qwen_image_edit - qwen_image_2_1_edit - boogu_image_edit - reference_image - vaeREADME.md+2
chain_injectors/qwen_image_2_1_edit_injector.pyAdded+73
core/pipelines/pipeline_input_processor.py+12
core/pipelines/sd_image_pipeline.py+2
core/pipelines/workflow_recipes/_partials/conditioning/qwen-image-2.1.yamlAdded+78
requirements.txt+45-45
ui/events/chain_handlers.py+33
ui/events/change_handlers.py+4-2
ui/events/main.py+9-3
ui/events/run_handlers.py+3-1
ui/imagegen_ui.py+2-1
ui/shared/ui_components.py+29
yaml/chain_features.yaml+15
yaml/constants.yaml+9
yaml/file_list.yaml+13
yaml/model_architecture_features.yaml+5
yaml/model_architectures.yaml+4
yaml/model_defaults.yaml+8-1
yaml/model_list.yaml+8
yaml/task_features.yaml+5