city96 / ComfyUI_ExtraModels

Support for miscellaneous image models. Currently supports: DiT, PixArt, HunYuanDiT, MiaoBi, and a few VAEs.
Apache License 2.0
394 stars 35 forks source link

Pixart sigma model loading errors after update comfyui #79

Open dalcefo opened 3 months ago

dalcefo commented 3 months ago

There were no problem before, but i had update comfyui and ExtraModels node, then i got erroor like this. Did I do something wrong? Or is there a problem with the extramodel code?

Error occurred when executing PixArtCheckpointLoader:

'EXM_PixArt_Model' object has no attribute 'diffusion_model'

File "C:\ComfyUI_windows_portable\ComfyUI\execution.py", line 152, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\ComfyUI_windows_portable\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 "C:\ComfyUI_windows_portable\ComfyUI\execution.py", line 75, in map_node_over_list results.append(getattr(obj, func)(*slice_dict(input_data_all, i))) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_ExtraModels\PixArt\nodes.py", line 29, in load_checkpoint model = load_pixart( ^^^^^^^^^^^^ File "C:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_ExtraModels\PixArt\loader.py", line 78, in load_pixart model = EXM_PixArt_Model( # same as comfy.model_base.BaseModel ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_ExtraModels\PixArt\loader.py", line 30, in init super().init(args, **kwargs) File "C:\ComfyUI_windows_portable\ComfyUI\comfy\model_base.py", line 97, in init logging.info("model weight dtype {}, manual cast: {}".format(self.get_dtype(), self.manual_cast_dtype)) ^^^^^^^^^^^^^^^^ File "C:\ComfyUI_windows_portable\ComfyUI\comfy\model_base.py", line 127, in get_dtype return self.diffusion_model.dtype ^^^^^^^^^^^^^^^^^^^^ File "C:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\nn\modules\module.py", line 1729, in getattr raise AttributeError(f"'{type(self).name}' object has no attribute '{name}'")

city96 commented 3 months ago

Update ComfyUI itself, it should be fixed now.

Creepybits commented 3 months ago

I just had the same issue as the OP. Updated Comfy and the problem is still there. There's just no way to use Pixart, no matter what I try.

city96 commented 3 months ago

@Creepybits Did you do a fresh git pull?

Creepybits commented 3 months ago

I updated through manager. From which folder should I do git pull? I'm not very familiar with that.

Creepybits commented 3 months ago

@Creepybits Did you do a fresh git pull?

Nevermind, figured it out. I have done a git pull and it says everything is already up to date. The full error message I'm getting is this:

!!! Exception during processing!!! 'EXM_PixArt_Model' object has no attribute 'diffusion_model' Traceback (most recent call last): File "C:\AI Stuff\ComfyUI\ComfyUI\execution.py", line 152, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\AI Stuff\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 "C:\AI Stuff\ComfyUI\ComfyUI\execution.py", line 75, in map_node_over_list results.append(getattr(obj, func)(**slice_dict(input_data_all, i))) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\AI Stuff\ComfyUI\ComfyUI\custom_nodes\ComfyUI_ExtraModels\PixArt\nodes.py", line 29, in load_checkpoint model = load_pixart( ^^^^^^^^^^^^ File "C:\AI Stuff\ComfyUI\ComfyUI\custom_nodes\ComfyUI_ExtraModels\PixArt\loader.py", line 78, in load_pixart model = EXM_PixArt_Model( # same as comfy.model_base.BaseModel ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\AI Stuff\ComfyUI\ComfyUI\custom_nodes\ComfyUI_ExtraModels\PixArt\loader.py", line 30, in __init__ super().__init__(*args, **kwargs) File "C:\AI Stuff\ComfyUI\ComfyUI\comfy\model_base.py", line 97, in __init__ logging.info("model weight dtype {}, manual cast: {}".format(self.get_dtype(), self.manual_cast_dtype)) ^^^^^^^^^^^^^^^^ File "C:\AI Stuff\ComfyUI\ComfyUI\comfy\model_base.py", line 127, in get_dtype return self.diffusion_model.dtype ^^^^^^^^^^^^^^^^^^^^ File "C:\ProgramData\anaconda3\Lib\site-packages\torch\nn\modules\module.py", line 1729, in __getattr__ raise AttributeError(f"'{type(self).__name__}' object has no attribute '{name}'") AttributeError: 'EXM_PixArt_Model' object has no attribute 'diffusion_model'

city96 commented 3 months ago

From your error:

File "C:\AI Stuff\ComfyUI\ComfyUI\comfy\model_base.py", line 97, in __init__ logging.info("model weight dtype {}, manual cast: {}".format(self.get_dtype(), self.manual_cast_dtype)) 

On the latest ComfyUI that line is completely different i.e. it shouldn't produce the error anymore. It was removed yesterday in this commit: https://github.com/comfyanonymous/ComfyUI/commit/0a6b0081176c6233015ec00d004c534c088ddcb0

For some reason your local ComfyUI install isn't actually being updated.

Creepybits commented 3 months ago

From your error:

File "C:\AI Stuff\ComfyUI\ComfyUI\comfy\model_base.py", line 97, in __init__ logging.info("model weight dtype {}, manual cast: {}".format(self.get_dtype(), self.manual_cast_dtype)) 

On the latest ComfyUI that line is completely different i.e. it shouldn't produce the error anymore. It was removed yesterday in this commit: comfyanonymous/ComfyUI@0a6b008

For some reason your local ComfyUI install isn't actually being updated.

Weird. Thanks though, All try to figure out why it doesn't update correctly then.

city96 commented 3 months ago

Yeah, not sure what could cause that. What do you get when you run git status in the main ComfyUI folder (I assume C:\AI Stuff\ComfyUI\ComfyUI\)

Edit: also try update_comfyui.bat if you're on the standalone, assuming that's still a thing lol

Creepybits commented 3 months ago

Yeah, not sure what could cause that. What do you get when you run git status in the main ComfyUI folder (I assume C:\AI Stuff\ComfyUI\ComfyUI\)

Edit: also try update_comfyui.bat if you're on the standalone, assuming that's still a thing lol

I've just reinstalled comfy, and I get this from Git status

` PS C:\AI Stuff\ComfyUI\ComfyUI> git status fatal: detected dubious ownership in repository at 'C:/AI Stuff/ComfyUI/ComfyUI' 'C:/AI Stuff/ComfyUI/ComfyUI' is owned by: BUILTIN/Administrat�rer (S-1-5-32-544) but the current user is: CREEPYBITS/zanno (S-1-5-21-1515907332-654993848-3974-1003) To add an exception for this directory, call:

    git config --global --add safe.directory 'C:/AI Stuff/ComfyUI/ComfyUI'

PS C:\AI Stuff\ComfyUI\ComfyUI> `

It seems to be working so far at least.

pallavnawani commented 3 months ago

Hello, the PixArt checkpoint loader node is failing in ComfyUI with the following text:

Error occurred when executing PixArtCheckpointLoader:

ModelPatcher.__init__() got an unexpected keyword argument 'current_device'

  File "D:\Diffusion_Auto_F111\ComfyUI\ComfyUI_windows_portable\ComfyUI\execution.py", line 152, in recursive_execute
    output_data, output_ui = get_output_data(obj, input_data_all)
  File "D:\Diffusion_Auto_F111\ComfyUI\ComfyUI_windows_portable\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:\Diffusion_Auto_F111\ComfyUI\ComfyUI_windows_portable\ComfyUI\execution.py", line 75, in map_node_over_list
    results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
  File "D:\Diffusion_Auto_F111\ComfyUI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_ExtraModels\PixArt\nodes.py", line 29, in load_checkpoint
    model = load_pixart(
  File "D:\Diffusion_Auto_F111\ComfyUI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_ExtraModels\PixArt\loader.py", line 114, in load_pixart
    model_patcher = comfy.model_patcher.ModelPatcher(
Queue size: 0
Extra options

Any suggestions on what could be going wrong? (ComfyUI is already updated) Is it because I am trying to load the wrong model?

city96 commented 3 months ago

@pallavnawani It looks like your ExtraModels repo isn't on the latest version. That line no longer has the current_device option there

doogyhatts commented 1 month ago

After updating ComfyUI for SD35L, it appears that the t5_attention_mask attribute cannot be accessed in SD3ClipModel. So the PixArt T5 from SD3 Clip, which outputs T5, cannot be used to input into the CLIP Text Encode, which previously worked. I am using the T5xxl gguf text-encoder model.

This is the error. 'SD3ClipModel' object has no attribute 't5_attention_mask'

I checked the SD3ClipModel code for the versions v0.2.3 and v0.2.4. The version for v0.2.4 has the t5_attention_mask attribute, which it was assigned during the object's initialisation, while the v0.2.3 does not have.

I will use an older version of ComfyUI instead separately.

city96 commented 1 month ago

@doogyhatts should be good on both versions now, do a git pull on the extra models repo.

doogyhatts commented 1 week ago

Ok I found out what the error was now, after checking the latest sd.py. It used "if clip_type == CLIPType.SD3:" as the conditional. So I had to select 'sd3' as the type in the gguf clip loader, then it works again.