ComfyUI icon indicating copy to clipboard operation
ComfyUI copied to clipboard

i met an issue when using the the latest flux fill model in comfyu

Open huangkun1985 opened this issue 2 years ago • 14 comments

Expected Behavior

run the default work flow of fill model

Actual Behavior

unfortunately i met an issue when using the the latest flux fill model in comfyui, it says:

UNETLoader
Error(s) in loading state_dict for Flux:
size mismatch for img_in.weight: copying a param with shape torch.Size([3072, 384]) from checkpoint, the shape in current model is torch.Size([3072, 64]).

what does it means? how can i fix it?

check the log as below:

Steps to Reproduce

微信截图_20241122130959

Debug Logs

got prompt
Requested to load FluxClipModel_
Loading 1 new model
loaded completely 0.0 9319.23095703125 True
clip missing: ['text_projection.weight']
model weight dtype torch.bfloat16, manual cast: None
model_type FLUX
!!! Exception during processing !!! Error(s) in loading state_dict for Flux:
        size mismatch for img_in.weight: copying a param with shape torch.Size([3072, 384]) from checkpoint, the shape in current model is torch.Size([3072, 64]).
Traceback (most recent call last):
  File "D:\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\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\ComfyUI\execution.py", line 169, in _map_node_over_list
    process_inputs(input_dict, i)
  File "D:\ComfyUI_windows_portable\ComfyUI\execution.py", line 158, in process_inputs
    results.append(getattr(obj, func)(**inputs))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\ComfyUI_windows_portable\ComfyUI\nodes.py", line 875, in load_unet
    model = comfy.sd.load_diffusion_model(unet_path, model_options=model_options)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\ComfyUI_windows_portable\ComfyUI\comfy\sd.py", line 660, in load_diffusion_model
    model = load_diffusion_model_state_dict(sd, model_options=model_options)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\ComfyUI_windows_portable\ComfyUI\comfy\sd.py", line 651, in load_diffusion_model_state_dict
    model.load_model_weights(new_sd, "")
  File "D:\ComfyUI_windows_portable\ComfyUI\comfy\model_base.py", line 222, in load_model_weights
    m, u = self.diffusion_model.load_state_dict(to_load, strict=False)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\nn\modules\module.py", line 2584, in load_state_dict
    raise RuntimeError(
RuntimeError: Error(s) in loading state_dict for Flux:
        size mismatch for img_in.weight: copying a param with shape torch.Size([3072, 384]) from checkpoint, the shape in current model is torch.Size([3072, 64]).

Prompt executed in 55.84 seconds

Other

No response

huangkun1985 avatar Nov 22 '24 05:11 huangkun1985

yeah me too. i got the same exact error

FruitPigFoot avatar Nov 22 '24 05:11 FruitPigFoot

Is your ComfyUI the latest version (v0.3.1)?

ltdrdata avatar Nov 22 '24 05:11 ltdrdata

i've just updated and still got the same error

FruitPigFoot avatar Nov 22 '24 05:11 FruitPigFoot

i've just updated and still got the same error

Your ComfyUI has not been properly updated. Go to the ComfyUI directory in the command line and run git pull. It is likely failing.

image

ltdrdata avatar Nov 22 '24 05:11 ltdrdata

@ltdrdata you're right! i got it running now. thank you

FruitPigFoot avatar Nov 22 '24 05:11 FruitPigFoot

i've just updated and still got the same error

Your ComfyUI has not been properly updated. Go to the ComfyUI directory in the command line and run git pull. It is likely failing.

image

thanks, i fixed the problem, just use "git pull origin master" to update comfyui

huangkun1985 avatar Nov 22 '24 06:11 huangkun1985

Hi, I encountered the same issue specifically when using the FLUX.1 Fill model. The problem was resolved after updating the repository with git pull. It seems the latest updates addressed this issue.

If you're also using FLUX.1 Fill, you can try the following steps:

git checkout main git pull origin main

Once updated, restart ComfyUI and see if the problem is resolved. It worked for me, and I hope it helps others facing the same issue!

TonTonTWMAN avatar Nov 23 '24 01:11 TonTonTWMAN

git pull just gets me a message saying I need to specify a branch. I don't know why.

C:\Users\trevor\Programs\ComfyUI\ComfyUI>git pull There is no tracking information for the current branch. Please specify which branch you want to merge with. See git-pull(1) for details.

git pull <remote> <branch>

If you wish to set tracking information for this branch you can do so with:

git branch --set-upstream-to=origin/<branch> master

I also cannot figure out how I might be able to check the version of Comfy the closest I have is this.

image

if this is the right way then it suggests I am on 0.2.3?

tre4b avatar Nov 24 '24 17:11 tre4b

git checkout master
git pull

ltdrdata avatar Nov 25 '24 01:11 ltdrdata

Thanks everyone, that fixed it for me as well!

tedtninety avatar Nov 26 '24 05:11 tedtninety

Thanks everyone, that fixed it for me as well!

tedtninety avatar Nov 26 '24 05:11 tedtninety

我刚刚更新,但仍然出现相同的错误

您的 ComfyUI 尚未正确更新。在命令行中进入 ComfyUI 目录并运行git pull.很可能会失败。 图像

谢谢,我解决了问题,只需使用“git pull origin master”来更新 comfyui

按照此方法更新后,谷歌浏览器不能双击出搜索框了,这个有解决方案吗?

blue2024888 avatar Dec 04 '24 05:12 blue2024888

I am using the following version, and this error still exists. commit 82ecb02c1ed29455047dcaa3839497b2cfa92852 (HEAD -> master, origin/master, origin/HEAD) Author: catboxanon [email protected] Date: Sun Dec 29 20:06:49 2024 -0500

Remove duplicate calls to INPUT_TYPES (#6249)

image

dyanxi avatar Jan 02 '25 08:01 dyanxi

I just got a similar error running a flux - nf4 model (flux1-dev-bnb-nf4-v2.safetensors) :

size mismatch for img_in.weight: copying a param with shape torch.Size([98304, 1]) from checkpoint, the shape in current model is torch.Size([3072, 0])... sizes were very different tho but 3072 lead me here.. thanx I guess :)

this is because it requires BitsAndBytes NF4 Loaders to run

leaving this in case anyone else is in similar circumstances

appsmalthouse avatar Apr 09 '25 01:04 appsmalthouse