Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ComfyUI Workflow keeps getting AttributeError: 'SDXLClipModel' object has no attribute 'clip_layer' in the Efficient Loader #4

Closed
c4fun opened this issue Mar 21, 2024 · 2 comments

Comments

@c4fun
Copy link

c4fun commented Mar 21, 2024

Problem to solve

In the ComfyUI workflow, I keep getting this error and cannot run this workflow completely: AttributeError: 'SDXLClipModel' object has no attribute 'clip_layer'

log

model_path is /home/xxx/code/github.com/comfyanonymous/ComfyUI/custom_nodes/comfyui_controlnet_aux/ckpts/lllyasviel/Annotators/ZoeD_M12_N.pt
!!! Exception during processing !!!
Traceback (most recent call last):
  File "/home/xxx/code/github.com/comfyanonymous/ComfyUI/execution.py", line 151, in recursive_execute
    output_data, output_ui = get_output_data(obj, input_data_all)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/code/github.com/comfyanonymous/ComfyUI/execution.py", line 81, in get_output_data
    return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/code/github.com/comfyanonymous/ComfyUI/execution.py", line 74, in map_node_over_list
    results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/code/github.com/comfyanonymous/ComfyUI/custom_nodes/efficiency-nodes-comfyui/efficiency_nodes.py", line 172, in efficientloader
    encode_prompts(positive, negative, token_normalization, weight_interpretation, clip, clip_skip,
  File "/home/xxx/code/github.com/comfyanonymous/ComfyUI/custom_nodes/efficiency-nodes-comfyui/efficiency_nodes.py", line 73, in encode_prompts
    positive_encoded = bnk_adv_encode.AdvancedCLIPTextEncode().encode(clip, positive_prompt, token_normalization, weight_interpretation)[0]
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/code/github.com/comfyanonymous/ComfyUI/custom_nodes/efficiency-nodes-comfyui/py/bnk_adv_encode.py", line 288, in encode
    embeddings_final, pooled = advanced_encode(clip, text, token_normalization, weight_interpretation, w_max=1.0,
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/code/github.com/comfyanonymous/ComfyUI/custom_nodes/efficiency-nodes-comfyui/py/bnk_adv_encode.py", line 246, in advanced_encode
    embs_l, _ = advanced_encode_from_tokens(tokenized['l'],
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/code/github.com/comfyanonymous/ComfyUI/custom_nodes/efficiency-nodes-comfyui/py/bnk_adv_encode.py", line 183, in advanced_encode_from_tokens
    weighted_emb, pooled_base = encode_func(weighted_tokens)
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/code/github.com/comfyanonymous/ComfyUI/custom_nodes/efficiency-nodes-comfyui/py/bnk_adv_encode.py", line 249, in <lambda>
    lambda x: encode_token_weights(clip, x, encode_token_weights_l),
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/code/github.com/comfyanonymous/ComfyUI/custom_nodes/efficiency-nodes-comfyui/py/bnk_adv_encode.py", line 226, in encode_token_weights
    model.cond_stage_model.clip_layer(model.layer_idx)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/anaconda3/envs/comfyui/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1688, in __getattr__
    raise AttributeError(f"'{type(self).__name__}' object has no attribute '{name}'")
AttributeError: 'SDXLClipModel' object has no attribute 'clip_layer'

@c4fun
Copy link
Author

c4fun commented Mar 21, 2024

Solved it. The Efficient Loader components was too old. It works well after update to https://github.com/jags111/efficiency-nodes-comfyui/tree/1ac5f18

@c4fun c4fun closed this as completed Mar 21, 2024
@YoucanBaby
Copy link

same error.

Traceback (most recent call last):
  File "/root/data/xyf/personalization/ComfyUI/execution.py", line 151, in recursive_execute
    output_data, output_ui = get_output_data(obj, input_data_all)
  File "/root/data/xyf/personalization/ComfyUI/execution.py", line 81, in get_output_data
    return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
  File "/root/data/xyf/personalization/ComfyUI/execution.py", line 74, in map_node_over_list
    results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
  File "/root/data/xyf/personalization/ComfyUI/custom_nodes/efficiency-nodes-comfyui/efficiency_nodes.py", line 172, in efficientloader
    encode_prompts(positive, negative, token_normalization, weight_interpretation, clip, clip_skip,
  File "/root/data/xyf/personalization/ComfyUI/custom_nodes/efficiency-nodes-comfyui/efficiency_nodes.py", line 73, in encode_prompts
    positive_encoded = bnk_adv_encode.AdvancedCLIPTextEncode().encode(clip, positive_prompt, token_normalization, weight_interpretation)[0]
  File "/root/data/xyf/personalization/ComfyUI/custom_nodes/efficiency-nodes-comfyui/py/bnk_adv_encode.py", line 312, in encode
    embeddings_final, pooled = advanced_encode(clip, text, token_normalization, weight_interpretation, w_max=1.0,
  File "/root/data/xyf/personalization/ComfyUI/custom_nodes/efficiency-nodes-comfyui/py/bnk_adv_encode.py", line 246, in advanced_encode
    embs_l, _ = advanced_encode_from_tokens(tokenized['l'],
  File "/root/data/xyf/personalization/ComfyUI/custom_nodes/efficiency-nodes-comfyui/py/bnk_adv_encode.py", line 183, in advanced_encode_from_tokens
    weighted_emb, pooled_base = encode_func(weighted_tokens)
  File "/root/data/xyf/personalization/ComfyUI/custom_nodes/efficiency-nodes-comfyui/py/bnk_adv_encode.py", line 249, in <lambda>
    lambda x: encode_token_weights(clip, x, encode_token_weights_l),
  File "/root/data/xyf/personalization/ComfyUI/custom_nodes/efficiency-nodes-comfyui/py/bnk_adv_encode.py", line 226, in encode_token_weights
    model.cond_stage_model.clip_layer(model.layer_idx)
  File "/root/miniconda3/envs/comfyui/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1614, in __getattr__
    raise AttributeError("'{}' object has no attribute '{}'".format(
AttributeError: 'SDXLClipModel' object has no attribute 'clip_layer'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants