LucianoCirino / efficiency-nodes-comfyui

A collection of ComfyUI custom nodes. ⚠️ WARNING: This repo is no longer maintained.
https://civitai.com/models/32342
GNU General Public License v3.0
584 stars 134 forks source link

Error Occurred During KSampler (Efficient) Execution 'NoneType' object has no attribute 'cpu #225

Open suishiyu opened 8 months ago

suishiyu commented 8 months ago

Error Occurred During KSampler (Efficient) Execution 'NoneType' object has no attribute 'cpu

cliffrowley commented 8 months ago

Seems related to #204 - the erroring code didn't seem to exist before this PR. Le sigh.

Edit: I've tried replacing all the efficiency nodes in my workflow just in case, and deleting all pycache directories just to be thorough, and the error still occurs. Guess I'll just factor efficiency nodes out of my workflow and live without it.

MisterAoD commented 8 months ago

There is a change in how the encoding work! For some reason, it always return 'l' in tokenized and was not properly handled so it always return None. Here is my quick hack to let me use SD1.5 eff. loader for the time being.

In py/bnk_adv_encode.py change advance_encode to the following code (well, only the if 'l' in tokenized... block):

def advanced_encode(clip, text, token_normalization, weight_interpretation, w_max=1.0, clip_balance=.5, apply_to_pooled=True):
    tokenized = clip.tokenize(text, return_word_ids=True)
    if isinstance(tokenized, dict):
        embs_l = None
        embs_g = None
        pooled = None
        if 'l' in tokenized:
            if isinstance(clip.cond_stage_model, SDXLClipModel):
                embs_l, _ = advanced_encode_from_tokens(tokenized['l'], 
                                                    token_normalization, 
                                                    weight_interpretation, 
                                                    lambda x: encode_token_weights(clip, x, encode_token_weights_l),
                                                    w_max=w_max, 
                                                    return_pooled=False)
            else:
                return advanced_encode_from_tokens(tokenized['l'], 
                                                    token_normalization, 
                                                    weight_interpretation, 
                                                    lambda x: encode_token_weights(clip, x, encode_token_weights_l),
                                                    w_max=w_max)
        if 'g' in tokenized:
            embs_g, pooled = advanced_encode_from_tokens(tokenized['g'], 
                                                         token_normalization, 
                                                         weight_interpretation,
                                                         lambda x: encode_token_weights(clip, x, encode_token_weights_g),
                                                         w_max=w_max, 
                                                         return_pooled=True,
                                                         apply_to_pooled=apply_to_pooled)
        return prepareXL(embs_l, embs_g, pooled, clip_balance)
    else:
        return advanced_encode_from_tokens(tokenized,
                                           token_normalization,
                                           weight_interpretation,
                                           lambda x: (clip.encode_from_tokens(x), None),
                                           w_max=w_max)
gateway commented 8 months ago

yea i just ran into this a well, ill test the hack but hopefully something in the main branch can get pushed!

edit: This code fixed my issue fyi..

ahtoshkaa commented 8 months ago

Thank you so much. The codefix helped

aegis72 commented 8 months ago

Having the same issue after latest update. Luckily, I have a non updated install that still works for my workflow. Will try this fix as well. Edit: Yep; fixed. I did have to delete the files in the efficiency nodes/py/pycache directory though. I just replaced the entire block with this one here.

LukeOvermind commented 8 months ago

I can confirm that this not only a Efficiency Node issue only, Using TTN Piple Loader also give 'NoneType' object has no attribute errors. And just for SD1.5

justanothernguyen commented 8 months ago

This is because of ComfyUI update. I just rolled back to a backup branch in comfy and EfficiencyNode works again. (But IPAdapterPlus broke... sigh)

ahtoshkaa commented 8 months ago

Yeah, stuff broke for me over a week ago. I'm no programmer but thanks to GPT I've added a cell to the colab that fixed it. It seems that various plugins broke as well.

вс, 29 окт. 2023 г. в 11:31, justanothernguyen @.***>:

This is because of ComfyUI update. I just rolled back to a backup branch in comfy and EfficiencyNode works again. (But IPAdapterPlus broke... sigh)

— Reply to this email directly, view it on GitHub https://github.com/LucianoCirino/efficiency-nodes-comfyui/issues/225#issuecomment-1784046705, or unsubscribe https://github.com/notifications/unsubscribe-auth/A5NVRALQWNO3GB6WLSZEWLLYBYO6BAVCNFSM6AAAAAA6TMVZ2GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOBUGA2DMNZQGU . You are receiving this because you commented.Message ID: @.***>

satscape commented 8 months ago

Updated all nodes and Comfy today... all efficiency nodes seem broke with that error and others. Using old fashioned loaders and ksamplers worksaround for me. Note to self: BACKUP BEFORE UPDATING next time 😁 UPDATE: I've gone back to using the vanilla nodes, as several other issues I was having (that I thought was Comfy) have been fixed by using vanilla checkpoint loader and ksampler! Oh well, I do like the extra spaghetti anyway.

ahtoshkaa commented 8 months ago

Unfortunately since i use google colab I had auto update enabled. So everything broke :( thankfully the fix seems to work for the most part

вс, 29 окт. 2023 г. в 18:22, Satscape @.***>:

Updated all nodes and Comfy today... all efficiency nodes seem broke with that error and others. Using old fashioned loaders and ksamplers worksaround for me. Note to self: BACKUP BEFORE UPDATING next time 😁

— Reply to this email directly, view it on GitHub https://github.com/LucianoCirino/efficiency-nodes-comfyui/issues/225#issuecomment-1784157829, or unsubscribe https://github.com/notifications/unsubscribe-auth/A5NVRALAYJM4ZDXXV7BQKVDYBZYBXAVCNFSM6AAAAAA6TMVZ2GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOBUGE2TOOBSHE . You are receiving this because you commented.Message ID: @.***>

RigzTD commented 8 months ago

Yeah same here when I updated and everything went kaboom, had this happen a few days ago before this was flagged thinking I broke something in the update, was able to restore a backup thankfully and wanted to try again today to see if it was fixed but the exact same thing happened again. The code fix above did the trick to solve it temporarily till it gets fixed officially. Glad at least its not just me running into this lol like everyone else is saying ALWAYS BACKUP BEFORE AN UPDATE!!!

Vision25th commented 8 months ago

Noob here with same issue , worked fine till yesterday :( i've been replacing all samplers on workflows by effi ones :/ ... I'll try the hack fix :)

Edit: new code worked!! thanks so much :D ... My Backup did not have the custom nodes ... :D

gacela80 commented 8 months ago

@MisterAoD codefix worked !!! thanks

Takeover713 commented 8 months ago

@MisterAoD Code worked thank you. Greatly appreciate it!!

gateway commented 8 months ago

Any updates to moving this to dev branch, out of the 10 or so here posting about the issue prob 100's are having it and not using the nodes anymore :/ .. also I think Comfy Devs need to figure out good sort of unit testing , maybe we as a group create a few templates with the Efficient pack and then before pushing out changes they could be run as a test to see what breaks.. anyhow just some thoughts.. cheers and thank you for taking the time to create this!

spiralofhope commented 8 months ago

@MisterAoD

In py/bnk_adv_encode.py change advance_encode to the following code (well, only the if 'l' in tokenized... block):

Thanks for the hack.

It took me two tries before I realised I had to instead search for advanced_encode :)

Also thanks @suishiyu for a good issue title so I could find it easily!

jags111 commented 8 months ago

I have updated into my fork and updating any issues here in my forked repo https://github.com/jags111/efficiency-nodes-comfyui please update and inform if any more issues. Thanks

alenknight commented 8 months ago

I have updated into my fork and updating any issues here in my forked repo https://github.com/jags111/efficiency-nodes-comfyui please update and inform if any more issues. Thanks

your fork worked for me... thanks for putting this out there.