new Controlnet for 3.5Large,'NoneType" object has no attribute 'keys’
Expected Behavior
loading the new 3.5 large controlnet file
Actual Behavior
'NoneType" object has no attribute 'keys’
Steps to Reproduce
Debug Logs
Prompt executed in 0.14 seconds
got prompt
!!! Exception during processing !!! 'NoneType' object has no attribute 'keys'
Traceback (most recent call last):
File "D:\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\ComfyUI\execution.py", line 323, in execute
output_data, output_ui, has_subgraph = get_output_data(obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\ComfyUI\execution.py", line 198, in get_output_data
return_values = _map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\ComfyUI\execution.py", line 169, in _map_node_over_list
process_inputs(input_dict, i)
File "D:\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\ComfyUI\execution.py", line 158, in process_inputs
results.append(getattr(obj, func)(**inputs))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\ComfyUI\nodes.py", line 771, in load_controlnet
controlnet = comfy.controlnet.load_controlnet(controlnet_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\ComfyUI\comfy\controlnet.py", line 654, in load_controlnet
cnet = load_controlnet_state_dict(comfy.utils.load_torch_file(ckpt_path, safe_load=True), model=model, model_options=model_options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\ComfyUI\comfy\controlnet.py", line 563, in load_controlnet_state_dict
return load_controlnet_mmdit(controlnet_data, model_options=model_options) #SD3 diffusers controlnet
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\ComfyUI\comfy\controlnet.py", line 432, in load_controlnet_mmdit
model_config, operations, load_device, unet_dtype, manual_cast_dtype, offload_device = controlnet_config(new_sd, model_options=model_options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\ComfyUI\comfy\controlnet.py", line 398, in controlnet_config
model_config = comfy.model_detection.model_config_from_unet(sd, "", True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\ComfyUI\comfy\model_detection.py", line 327, in model_config_from_unet
unet_config = detect_unet_config(state_dict, unet_key_prefix)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\ComfyUI\comfy\model_detection.py", line 37, in detect_unet_config
state_dict_keys = list(state_dict.keys())
^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'keys'
Other
No response
I'm seeing multiple other people with this as well.
Chiming in with the same error trying out the SD 3.5 demo workflows
ComfyUI Error Report
Error Details
- Node ID: 57
- Node Type: ControlNetLoader
- Exception Type: AttributeError
- Exception Message: 'NoneType' object has no attribute 'keys'
Stack Trace
File "D:\ComfyUI05\ComfyUI\execution.py", line 323, in execute
output_data, output_ui, has_subgraph = get_output_data(obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUI05\ComfyUI\execution.py", line 198, in get_output_data
return_values = _map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUI05\ComfyUI\execution.py", line 169, in _map_node_over_list
process_inputs(input_dict, i)
File "D:\ComfyUI05\ComfyUI\execution.py", line 158, in process_inputs
results.append(getattr(obj, func)(**inputs))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUI05\ComfyUI\nodes.py", line 771, in load_controlnet
controlnet = comfy.controlnet.load_controlnet(controlnet_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUI05\ComfyUI\comfy\controlnet.py", line 654, in load_controlnet
cnet = load_controlnet_state_dict(comfy.utils.load_torch_file(ckpt_path, safe_load=True), model=model, model_options=model_options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUI05\ComfyUI\comfy\controlnet.py", line 563, in load_controlnet_state_dict
return load_controlnet_mmdit(controlnet_data, model_options=model_options) #SD3 diffusers controlnet
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUI05\ComfyUI\comfy\controlnet.py", line 432, in load_controlnet_mmdit
model_config, operations, load_device, unet_dtype, manual_cast_dtype, offload_device = controlnet_config(new_sd, model_options=model_options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUI05\ComfyUI\comfy\controlnet.py", line 398, in controlnet_config
model_config = comfy.model_detection.model_config_from_unet(sd, "", True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUI05\ComfyUI\comfy\model_detection.py", line 327, in model_config_from_unet
unet_config = detect_unet_config(state_dict, unet_key_prefix)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUI05\ComfyUI\comfy\model_detection.py", line 37, in detect_unet_config
state_dict_keys = list(state_dict.keys()
seems like they r working on it……
Update ComfyUI. Just the blog was revealed before pushing the commit. lol.
Funny, I updated before trying the workflows :) seems to work fine now after another ComfyUI update, cheers!
Funny, I updated before trying the workflows :) seems to work fine now after another ComfyUI update, cheers!
It's fixed for me updating 3 minutes ago.
The desktop version still has this problem, I don't know how to fix it. Does someone has the same problem in the Comfy desktop v1?
The desktop version still has this problem, I don't know how to fix it. Does someone has the same problem in the Comfy desktop v1?
same here!
How to fix this bug
If you know how to pull, pull the newest verison. If not, download the latest 0.3.5 verison, unzip it, overwrite the old one, and you are good to go. Just tested it , no problem at all. So next time, when flux published new models, update comfyui (0.3.4), when sd published new models, update comfyui(0.3.5), do not try to fix it by yourself.
my comfy is up to date and I am still seeing this error. Am I missing something?
same error, comfyui 0.3.10
I updated to the latest ComfyUI and I've tried all versions from 0.3.5 to the current head and I have the same error.
same problem on latest version
Speculating: I think the issue might be due to how the autodetection of SD3.x vs SD3.5 is happening.
controlnet.py line 654:
elif "controlnet_blocks.0.weight" in controlnet_data:
if "double_blocks.0.img_attn.norm.key_norm.scale" in controlnet_data:
return load_controlnet_flux_xlabs_mistoline(controlnet_data, model_options=model_options)
elif "pos_embed_input.proj.weight" in controlnet_data:
if "transformer_blocks.0.adaLN_modulation.1.bias" in controlnet_data:
return load_controlnet_sd35(controlnet_data, model_options=model_options) #Stability sd3.5 format
else:
return load_controlnet_mmdit(controlnet_data, model_options=model_options) #SD3 diffusers controlnet
But the controlnet data for the 3.5 depth model doesn't have the transformer_blocks.0.adaLN_modulation.1.bias structure. The nearest thing I can find is transformer_blocks.0.attn.to_k.bias, but that's just plain string matching. Off the top of my head I don't know what the adaLN modulation maps to, but I feel like an explicit node for SD3.5 controlnet loading would solve the problem.
EDIT: I've confirmed this is the case by hot-patching line 654 to this:
if True: #"transformer_blocks.0.adaLN_modulation.1.bias" in controlnet_data:
This skips the check and always runs the 3.5 controlnet loader. There's still some kind of numerical instability in my workflow, but it does load and run end-to-end.