jags111 / efficiency-nodes-comfyui

A collection of ComfyUI custom nodes.- Awesome smart way to work with nodes!
https://civitai.com/models/32342
GNU General Public License v3.0
974 stars 97 forks source link

Error occurred when executing Efficient Loader: #113

Closed Dimaray closed 8 months ago

Dimaray commented 8 months ago

SD 1.5 works fine SDXL gives the error below.

image

got prompt [rgthree] Using rgthree's optimized recursive execution. ERROR:root:!!! Exception during processing !!! ERROR:root:Traceback (most recent call last): File "D:#AI\ComfyUI\execution.py", line 152, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:#AI\ComfyUI\execution.py", line 82, in get_output_data return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:#AI\ComfyUI\execution.py", line 75, in map_node_over_list results.append(getattr(obj, func)(**slice_dict(input_data_all, i))) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:#AI\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 "D:#AI\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 "D:#AI\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 "D:#AI\ComfyUI\custom_nodes\efficiency-nodes-comfyui\py\bnk_adv_encode.py", line 246, in advanced_encode embsl, = advanced_encode_from_tokens(tokenized['l'], ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:#AI\ComfyUI\custom_nodes\efficiency-nodes-comfyui\py\bnk_adv_encode.py", line 187, in advanced_encode_from_tokens base_emb, pooled_base = encode_func(unweighted_tokens) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:#AI\ComfyUI\custom_nodes\efficiency-nodes-comfyui\py\bnk_adv_encode.py", line 249, in lambda x: encode_token_weights(clip, x, encode_token_weights_l), ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:#AI\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 "D:#AI\python_embeded\Lib\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'

Prompt executed in 78.52 seconds

15ky3 commented 8 months ago

Also got the same error on Linux on Vast.ai machine

apviedra commented 8 months ago

Experiencing same problem, just after update.

bittermethod commented 8 months ago

Just updated and I am getting this error. Workflow was working just fine before the update. SD1.5 models still work fine, just the SDXL models.

Dimaray commented 8 months ago

Just updated and I am getting this error. Workflow was working just fine before the update. SD1.5 models still work fine, just the SDXL models.

Thanks, forgot to add that in my post

gonzalu commented 8 months ago

Getting the same today... worked fine yesterday.

Error occurred when executing Efficient Loader:

'SDXLClipModel' object has no attribute 'clip_layer'

File "E:\ComfyUI\ComfyUI\execution.py", line 152, in recursive_execute
output_data, output_ui = get_output_data(obj, input_data_all)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\ComfyUI\ComfyUI\execution.py", line 82, in get_output_data
return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\ComfyUI\ComfyUI\execution.py", line 75, in map_node_over_list
results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\ComfyUI\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 "E:\ComfyUI\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 "E:\ComfyUI\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 "E:\ComfyUI\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 "E:\ComfyUI\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 "E:\ComfyUI\ComfyUI\custom_nodes\efficiency-nodes-comfyui\py\bnk_adv_encode.py", line 249, in
lambda x: encode_token_weights(clip, x, encode_token_weights_l),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\ComfyUI\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 "E:\ComfyUI\python_embeded\Lib\site-packages\torch\nn\modules\module.py", line 1695, in __getattr__
raise AttributeError(f"'{type(self).__name__}' object has no attribute '{name}'")

I can confirm SD15 models work ok with the standard Efficient Loader.

Eff. SDXL Loader is not giving any errors.

gonzalu commented 8 months ago

ttN loader also showing similar errors.

image

curiousjp commented 8 months ago

Appears to be a result of this change - https://github.com/comfyanonymous/ComfyUI/commit/c2cb8e889b6a6d45eba26a534bf57aff86b320eb which retired clip_layer in favour of set_clip_options and a new argument format. That commit shows what the new invocation should look like. Unfortunately cannot prepare a PR of my own as am posting from my phone, but you should be able to temporarily patch your local copies appropriately.

Dimaray commented 8 months ago

Appears to be a result of this change - comfyanonymous/ComfyUI@c2cb8e8 which retired clip_layer in favour of set_clip_options and a new argument format. That commit shows what the new invocation should look like. Unfortunately cannot prepare a PR of my own as am posting from my phone, but you should be able to temporarily patch your local copies appropriately.

Thanks for the info, wish I knew how to patch it myself ^^ will have to just wait and see.

OtakuD commented 8 months ago

Go to: ComfyUI/custom_nodes/efficiency-nodes-comfyui/py/ and open "bnk_adv_encode.py" in a text editor (Recommend Notepad++)

Go to line 226: model.cond_stage_model.clip_layer(model.layer_idx)

and replace it with: model.cond_stage_model.set_clip_options({"layer": model.layer_idx})

jags111 commented 8 months ago

hey all i am updating a fix and it should be fine with it.

jags111 commented 8 months ago

all changes are complete and a note please update eff nodes to latest.

jags111 commented 8 months ago
2024-02-27_07-49-33 2024-02-27_07-49-55
ac-pill commented 8 months ago

Hi guys, thanks for the great work.

I wanted to post this as the issue seems to be standing, got the same error after the update: ERROR:root:!!! Exception during processing !!! ERROR:root:Traceback (most recent call last): File "/workspace/ComfyUI/execution.py", line 159, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) File "/workspace/ComfyUI/execution.py", line 89, in get_output_data return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True) File "/workspace/ComfyUI/execution.py", line 82, in map_node_over_list results.append(getattr(obj, func)(**slice_dict(input_data_all, i))) File "/workspace/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 "/workspace/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 "/workspace/ComfyUI/custom_nodes/efficiency-nodes-comfyui/py/bnk_adv_encode.py", line 313, in encode embeddings_final, pooled = advanced_encode(clip, text, token_normalization, weight_interpretation, w_max=1.0, File "/workspace/ComfyUI/custom_nodes/efficiency-nodes-comfyui/py/bnk_adv_encode.py", line 247, in advanced_encode embsl, = advanced_encode_from_tokens(tokenized['l'], File "/workspace/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 "/workspace/ComfyUI/custom_nodes/efficiency-nodes-comfyui/py/bnk_adv_encode.py", line 250, in lambda x: encode_token_weights(clip, x, encode_token_weights_l), File "/workspace/ComfyUI/custom_nodes/efficiency-nodes-comfyui/py/bnk_adv_encode.py", line 227, in encode_token_weights model.cond_stage_model.set_clip_options({"layer": model.layer_idx}) File "/usr/local/lib/python3.10/dist-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 'set_clip_options'

Seems I have the same custom_node combinations with rgthree as well.

LiJT commented 8 months ago

Error occurred when executing Efficient Loader:

'SDXLClipModel' object has no attribute 'clip_layer'

File "E:\ComfyUI-aki-v1.2\execution.py", line 152, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) File "E:\ComfyUI-aki-v1.2\execution.py", line 82, in get_output_data return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True) File "E:\ComfyUI-aki-v1.2\execution.py", line 75, in map_node_over_list results.append(getattr(obj, func)(**slice_dict(input_data_all, i))) File "E:\ComfyUI-aki-v1.2\custom_nodes\efficiency-nodes-comfyui\efficiency_nodes.py", line 172, in efficientloader encode_prompts(positive, negative, token_normalization, weight_interpretation, clip, clip_skip, File "E:\ComfyUI-aki-v1.2\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 "E:\ComfyUI-aki-v1.2\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 "E:\ComfyUI-aki-v1.2\custom_nodes\efficiency-nodes-comfyui\py\bnk_adv_encode.py", line 246, in advanced_encode embsl, = advanced_encode_from_tokens(tokenized['l'], File "E:\ComfyUI-aki-v1.2\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 "E:\ComfyUI-aki-v1.2\custom_nodes\efficiency-nodes-comfyui\py\bnk_adv_encode.py", line 249, in lambda x: encode_token_weights(clip, x, encode_token_weights_l), File "E:\ComfyUI-aki-v1.2\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 "E:\ComfyUI-aki-v1.2\python\lib\site-packages\torch\nn\modules\module.py", line 1695, in getattr raise AttributeError(f"'{type(self).name}' object has no attribute '{name}'")

I still get this error with SDXL model

metalwen commented 7 months ago

Go to: ComfyUI/custom_nodes/efficiency-nodes-comfyui/py/转到:ComfyUI/custom_nodes/efficiency-nodes-comfyui/py/ and open "bnk_adv_encode.py" in a text editor (Recommend Notepad++)并在文本编辑器中打开“bnk_adv_encode.py”(推荐记事本++)

Go to line 226: 转到第 226 行: model.cond_stage_model.clip_layer(model.layer_idx)model.cond_stage_model.clip_layer(model.layer_idx)

and replace it with: 并将其替换为: model.cond_stage_model.set_clip_options({"layer": model.layer_idx})model.cond_stage_model.set_clip_options({“层”: model.layer_idx})

THX,it's works!