Spaces:
Running on Zero
Running on Zero
refactor(controlnet): align Qwen-Image-2.1 with merged Fun ControlNet and bump upstream deps
Browse filesFiles changed (4)
27 unmodified lines2829303132333435363719 unmodified lines5758596061626364656667686970717273747527 unmodified linesdefault_megapixels = 1.0megapixels = float(chain_definition.get('megapixels', default_megapixels))# 1. Qwen-Image-2.1 Fun ControlNetif template_name == "QwenImage21FunControlNetApply":if 'model' not in assembler.workflow[ksampler_id]['inputs']:print(f"Warning: KSampler node '{ksampler_name}' is missing 'model' input. Skipping Qwen Fun ControlNet.")returncurrent_model_connection = assembler.workflow[ksampler_id]['inputs']['model']19 unmodified linesapply_cn_id = assembler._get_unique_id()apply_cn_node = assembler._get_node_template(template_name)apply_cn_node['inputs']['strength'] = item_data.get('strength', 1.0)apply_cn_node['inputs']['start_percent'] = 0.0apply_cn_node['inputs']['end_percent'] = 1.0apply_cn_node['inputs']['model'] = current_model_connectionapply_cn_node['inputs']['model_patch'] = [patch_loader_id, 0]apply_cn_node['inputs']['control_image'] = [image_scaler_id, 0]if vae_connection:apply_cn_node['inputs']['vae'] = vae_connectionassembler.workflow[apply_cn_id] = apply_cn_nodecurrent_model_connection = [apply_cn_id, 0]assembler.workflow[ksampler_id]['inputs']['model'] = current_model_connectionprint(f"Qwen Fun ControlNet injector applied. KSampler model input redirected through {len(chain_items)} node(s).")return# 2. Anima LLLite ControlNet27 unmodified lines2829303132333435363719 unmodified lines57585960616263646566676869707172737475767778798027 unmodified linesdefault_megapixels = 1.0megapixels = float(chain_definition.get('megapixels', default_megapixels))# 1. Fun ControlNet (Qwen-Image-2.1)if template_name in ("ZImageFunControlnet", "QwenImage21FunControlNetApply"):if 'model' not in assembler.workflow[ksampler_id]['inputs']:print(f"Warning: KSampler node '{ksampler_name}' is missing 'model' input. Skipping Fun ControlNet.")returncurrent_model_connection = assembler.workflow[ksampler_id]['inputs']['model']19 unmodified linesapply_cn_id = assembler._get_unique_id()apply_cn_node = assembler._get_node_template(template_name)apply_cn_node['inputs']['strength'] = item_data.get('strength', 1.0)if 'start_percent' in apply_cn_node.get('inputs', {}):apply_cn_node['inputs']['start_percent'] = item_data.get('start_percent', 0.0)if 'end_percent' in apply_cn_node.get('inputs', {}):apply_cn_node['inputs']['end_percent'] = item_data.get('end_percent', 1.0)apply_cn_node['inputs']['model'] = current_model_connectionapply_cn_node['inputs']['model_patch'] = [patch_loader_id, 0]if 'image' in apply_cn_node.get('inputs', {}):apply_cn_node['inputs']['image'] = [image_scaler_id, 0]elif 'control_image' in apply_cn_node.get('inputs', {}):apply_cn_node['inputs']['control_image'] = [image_scaler_id, 0]if vae_connection and 'vae' in apply_cn_node.get('inputs', {}):apply_cn_node['inputs']['vae'] = vae_connectionassembler.workflow[apply_cn_id] = apply_cn_nodecurrent_model_connection = [apply_cn_id, 0]assembler.workflow[ksampler_id]['inputs']['model'] = current_model_connectionprint(f"Fun ControlNet injector applied. KSampler model input redirected through {len(chain_items)} node(s).")return# 2. Anima LLLite ControlNet
24 unmodified lines25262728293031323334353624 unmodified lineselse:print("✅ ComfyUI repository already exists.")try:print("--- [Setup] Applying PR #16519 for ComfyUI (Qwen-Image 2.1 Fun ControlNet) ---")os.system(f"git -C {COMFYUI_TEMP_DIR} fetch --depth 1 origin pull/16519/head && git -c user.name=dev -c user.email=dev@example.com -C {COMFYUI_TEMP_DIR} merge --no-edit FETCH_HEAD || git -C {COMFYUI_TEMP_DIR} checkout -f FETCH_HEAD")print("✅ Successfully applied PR #16519.")except Exception as e:print(f"⚠️ Warning: Could not apply PR #16519 for ComfyUI: {e}")print(f"--- Merging ComfyUI from '{COMFYUI_TEMP_DIR}' to '{APP_DIR}' ---")for item in os.listdir(COMFYUI_TEMP_DIR):24 unmodified lines25262728293024 unmodified lineselse:print("✅ ComfyUI repository already exists.")print(f"--- Merging ComfyUI from '{COMFYUI_TEMP_DIR}' to '{APP_DIR}' ---")for item in os.listdir(COMFYUI_TEMP_DIR):
50 unmodified lines5152535455565750 unmodified linesdynamic_controlnet_chains:controlnet_chain:template: "QwenImage21FunControlNetApply"ksampler_node: "ksampler"vae_source: "vae_loader:0"50 unmodified lines5152535455565750 unmodified linesdynamic_controlnet_chains:controlnet_chain:template: "ZImageFunControlnet"ksampler_node: "ksampler"vae_source: "vae_loader:0"
1234515 unmodified lines21222324252627comfyui-frontend-package==1.53.6comfyui-workflow-templates==0.11.69comfyui-embedded-docs==0.5.12torchtorchsde15 unmodified linesSQLAlchemy>=2.0.0filelockav>=17.0.0comfy-kitchen==0.2.35comfy-aimdo==0.5.5requestssimpleeval>=1.0.01234515 unmodified lines21222324252627comfyui-frontend-package==1.53.6comfyui-workflow-templates==0.11.70comfyui-embedded-docs==0.5.12torchtorchsde15 unmodified linesSQLAlchemy>=2.0.0filelockav>=17.0.0comfy-kitchen==0.2.36comfy-aimdo==0.5.5requestssimpleeval>=1.0.0
chain_injectors/controlnet_injector.py+13-8
comfy_integration/setup.py-6
core/pipelines/workflow_recipes/_partials/conditioning/qwen-image-2.1.yaml+1-1
requirements.txt+2-2