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

No longer works since latest Comfy Update #25

Open
Pantonia4 opened this issue Nov 13, 2024 · 20 comments
Open

No longer works since latest Comfy Update #25

Pantonia4 opened this issue Nov 13, 2024 · 20 comments

Comments

@Pantonia4
Copy link

Pantonia4 commented Nov 13, 2024

Since todays update, PulID is no longer working on my end. Doing a rollback to the previous version makes it work again.

The Error:

!!! Exception during processing !!! forward_orig() takes from 7 to 9 positional arguments but 10 were given
Traceback (most recent call last):
  File "D:\AI\StabilityMatrix\Packages\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:\AI\StabilityMatrix\Packages\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:\AI\StabilityMatrix\Packages\ComfyUI\execution.py", line 169, in _map_node_over_list
    process_inputs(input_dict, i)
  File "D:\AI\StabilityMatrix\Packages\ComfyUI\execution.py", line 158, in process_inputs
    results.append(getattr(obj, func)(**inputs))
  File "D:\AI\StabilityMatrix\Packages\ComfyUI\comfy_extras\nodes_custom_sampler.py", line 633, in sample
    samples = guider.sample(noise.generate_noise(latent), latent_image, sampler, sigmas, denoise_mask=noise_mask, callback=callback, disable_pbar=disable_pbar, seed=noise.seed)
  File "D:\AI\StabilityMatrix\Packages\ComfyUI\comfy\samplers.py", line 740, in sample
    output = self.inner_sample(noise, latent_image, device, sampler, sigmas, denoise_mask, callback, disable_pbar, seed)
  File "D:\AI\StabilityMatrix\Packages\ComfyUI\comfy\samplers.py", line 719, in inner_sample
    samples = sampler.sample(self, sigmas, extra_args, callback, noise, latent_image, denoise_mask, disable_pbar)
  File "D:\AI\StabilityMatrix\Packages\ComfyUI\comfy\samplers.py", line 624, in sample
    samples = self.sampler_function(model_k, noise, sigmas, extra_args=extra_args, callback=k_callback, disable=disable_pbar, **self.extra_options)
  File "D:\AI\StabilityMatrix\Packages\ComfyUI\venv\lib\site-packages\torch\utils\_contextlib.py", line 116, in decorate_context
    return func(*args, **kwargs)
  File "D:\AI\StabilityMatrix\Packages\ComfyUI\comfy\k_diffusion\sampling.py", line 155, in sample_euler
    denoised = model(x, sigma_hat * s_in, **extra_args)
  File "D:\AI\StabilityMatrix\Packages\ComfyUI\comfy\samplers.py", line 299, in __call__
    out = self.inner_model(x, sigma, model_options=model_options, seed=seed)
  File "D:\AI\StabilityMatrix\Packages\ComfyUI\comfy\samplers.py", line 706, in __call__
    return self.predict_noise(*args, **kwargs)
  File "D:\AI\StabilityMatrix\Packages\ComfyUI\comfy\samplers.py", line 709, in predict_noise
    return sampling_function(self.inner_model, x, timestep, self.conds.get("negative", None), self.conds.get("positive", None), self.cfg, model_options=model_options, seed=seed)
  File "D:\AI\StabilityMatrix\Packages\ComfyUI\comfy\samplers.py", line 279, in sampling_function
    out = calc_cond_batch(model, conds, x, timestep, model_options)
  File "D:\AI\StabilityMatrix\Packages\ComfyUI\comfy\samplers.py", line 228, in calc_cond_batch
    output = model.apply_model(input_x, timestep_, **c).chunk(batch_chunks)
  File "D:\AI\StabilityMatrix\Packages\ComfyUI\comfy\model_base.py", line 144, in apply_model
    model_output = self.diffusion_model(xc, t, context=context, control=control, transformer_options=transformer_options, **extra_conds).float()
  File "D:\AI\StabilityMatrix\Packages\ComfyUI\venv\lib\site-packages\torch\nn\modules\module.py", line 1736, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
  File "D:\AI\StabilityMatrix\Packages\ComfyUI\venv\lib\site-packages\torch\nn\modules\module.py", line 1747, in _call_impl
    return forward_call(*args, **kwargs)
  File "D:\AI\StabilityMatrix\Packages\ComfyUI\comfy\ldm\flux\model.py", line 181, in forward
    out = self.forward_orig(img, img_ids, context, txt_ids, timestep, y, guidance, control, transformer_options)
TypeError: forward_orig() takes from 7 to 9 positional arguments but 10 were given
@adydeejay
Copy link

adydeejay commented Nov 13, 2024

It seems that the problem comes from this line. I modified it back to this and now image generation works with PuLID.

Please note that this is a temporary workaround for simple workflows with PuLID and is not a permanent fix; it may also impact the functionality of other nodes.

@fengwy
Copy link

fengwy commented Nov 13, 2024

same problem

@mbac
Copy link

mbac commented Nov 14, 2024

Same here

@Malie73
Copy link

Malie73 commented Nov 14, 2024

same problem, workaround does its job but please fix it.

@mbac
Copy link

mbac commented Nov 14, 2024

Maybe this is not the best place for this, but: can people please post here about any adverse effects they incur as a result of changing that line of code?

@stranger-games
Copy link

stranger-games commented Nov 14, 2024

I kept reverting comfyui to previous commits and reached the commit 8b90e50979b0d33e1f8d10d5c938361f59f95474 but still it's not working. @Pantonia4 Can you tell us which commit exactly broke this custom node?


In my case I just did the following which was referenced in another issue and all works well with the latest commit. So the error is not the same.

python.exe -s -m pip install --use-pep517 facexlib

OK, that was another error indeed but I still got the error mentioned here. I tried PR #27 which fixes this issue but in my case gives another error probably because of control net.


Actually I confirmed that it's not the control net, the PR seems to need an update.

@BerglinJ
Copy link

BerglinJ commented Nov 17, 2024

Use together with Hyper-FLUX.1-dev-8step-lora is not working either. Only get noise image

@adydeejay
Copy link

adydeejay commented Nov 17, 2024

It seems that the problem comes from this line. I modified it back to this and now image generation works with PuLID.

Please note that this is a temporary workaround for simple workflows with PuLID and is not a permanent fix; it may also impact the functionality of other nodes.

For me, the PuLID node stopped working immediately after I updated Comfyui on 2024-11-12. So, after @Pantonia4 posted the error "TypeError: forward_orig() takes from 7 to 9 positional arguments but 10 were given" in the Comfyui repository, considering that the PuLID nodes had not undergone changes, I started looking for what it was updated in Comfyui.

First I checked the branches.
https://github.com/comfyanonymous/ComfyUI/branches
https://github.com/comfyanonymous/ComfyUI/tree/patch_hooks_improved_memory
comfyanonymous/ComfyUI#5583
https://github.com/comfyanonymous/ComfyUI/tree/improved_memory
comfyanonymous/ComfyUI@improved_memory...master
click on Files changed
search for "flux" and "comfy/ldm/flux/model.py"

comfyanonymous/ComfyUI@improved_memory...master#diff-453e6e6c1a6fa355aa5f5b6aabb5f9153c526c115d08ad757c0243d9f8ca31ee

and I took each line in turn, so I discovered that removing transformer_options from ..ComfyUI_windows_portable\ComfyUI\comfy\ldm\flux\model.py solves the problem (at least for me).

out = self.forward_orig(img, img_ids, context, txt_ids, timestep, y, guidance, control, transformer_options)

comfyanonymous/ComfyUI@96b2080 aca3999a#diff-453e6e6c1a6fa355aa5f5b6aabb5f9153c526c115d08ad757c0243d9f8ca31eeL159

Maybe someone much more skilled will find a better solution - I'm not a coder.

Since 2024-11-12 I haven't updated Comfyui or any other nodes, and it seems that now there is a fix for forward_orig:
#27 (comment)

Using FLUX-Dev I get ~1 min (2.10s/it) to generate an 1080p image with PuLID and ~3 min to generate a video sequence 1080p 30fps (10.78s/it, dpmpp/karras/cfg2.5) using SVD/Video Helper Suite. Sometimes the time increases to 5-15 min per img/vid so I have to cleanup the VRAM or unload modules or to restart Comfyui to get the same working speed. But I personally find it extremely acceptable.

OK. Now I am trying to finish a personal project, but I hope that during the next week I will upgrade Comfyui and the nodes, I will test more and come back with more details. Also, I suspect a problem with the Nvidia driver and CUDA package on this torch version ... 2.4.1+cu121 was much faster. So... there will be more work.

My own specs + log, packages list and snapshot.

Platform: Windows 10 Pro 64-bit v.22H2
Python version: 3.11.8 (tags/v3.11.8:db85d51, Feb 6 2024, 22:03:32) [MSC v.1937 64 bit (AMD64)]
Total VRAM 24564 MB, total RAM 130980 MB
pytorch version: 2.5.1+cu124
xformers version: 0.0.28.post3
Set vram state to: NORMAL_VRAM
Device: cuda:0 NVIDIA GeForce RTX 4090 : cudaMallocAsync
GPU/s: NVIDIA GeForce RTX 4090
NVIDIA Driver: 566.03
ComfyUI-Manager (V2.51.9)
ComfyUI Revision: 2827 [8ebf2d88] | Released on '2024-11-12'

comfyui.log
packages list.txt
2024-11-17_23-59-18_snapshot.json

I hope this information helps you. Thanks everyone for all the great work!

@sorc1900
Copy link

Hi there, I see where it says change this line to this line. When I click the links it opens the code but I am not sure which line needs to be changed from what to what.

Not great at this, is there a line number I should be looking for.

@adydeejay
Copy link

Hi there, I see where it says change this line to this line. When I click the links it opens the code but I am not sure which line needs to be changed from what to what.

Not great at this, is there a line number I should be looking for.

image

@sorc1900
Copy link

Hi there, I see where it says change this line to this line. When I click the links it opens the code but I am not sure which line needs to be changed from what to what.
Not great at this, is there a line number I should be looking for.

Thanks for that, I noticed though the path doesn't line up with comfyui portable. Not sure where to look. If I search for model.py I see a few returns

@sorc1900
Copy link

Found it :)

@adydeejay
Copy link

Hi there, I see where it says change this line to this line. When I click the links it opens the code but I am not sure which line needs to be changed from what to what.
Not great at this, is there a line number I should be looking for.

Thanks for that, I noticed though the path doesn't line up with comfyui portable. Not sure where to look. If I search for model.py I see a few returns

You can find model.py here: [your drive]\ComfyUI_windows_portable\ComfyUI\comfy\ldm\flux\

@sorc1900
Copy link

:/ got this now

expected scalar type Half but found BFloat16

@adydeejay
Copy link

:/ got this now

expected scalar type Half but found BFloat16

If you're using FLUX/CUDA, make sure you are using the right model/vae/clip.
image

@stranger-games
Copy link

:/ got this now
expected scalar type Half but found BFloat16

If you're using FLUX/CUDA, make sure you are using the right model/vae/clip. image

Actually I tried #27 and I do get "expected scalar type Half but found BFloat16". The workflow is attached in #27 it uses GGUF, but I also tried another workflow that uses the fluxdev model also with #27 fix but still got the same "expected scalar type Half but found BFloat16" . I don't think it's related to the right mode/vae/clip.

@adydeejay
Copy link

adydeejay commented Nov 18, 2024

Actually I tried #27 and I do get "expected scalar type Half but found BFloat16". The workflow is attached in #27 it uses GGUF, but I also tried another workflow that uses the fluxdev model also with #27 fix but still got the same "expected scalar type Half but found BFloat16" . I don't think it's related to the right mode/vae/clip.

I know that workflow but never use it.
Anyway, let me know if this workflow works for you:
ady-pulid-flux-txt2img.json

Requested to load Flux
Loading 1 new model
loaded partially 14234.197129821778 15024.12890625 0
100%|██████████████████████████████████████████████████████████████████████████████████| 30/30 [01:08<00:00, 2.29s/it]
Requested to load AutoencodingEngine
Loading 1 new model
loaded completely 0.0 159.87335777282715 True
Prompt executed in 119.17 seconds

LE: BTW, for "expected scalar type Half but found BFloat16" error there is an opened issue here
#15

@sorc1900
Copy link

That's a cool workflow. I have been trying to do something like that to take the input face, a pose image and pulid them out. Always looks face details and skin looks plastic, plus pulid seems to drift a fair bit from the source

@stranger-games
Copy link

Actually I tried #27 and I do get "expected scalar type Half but found BFloat16". The workflow is attached in #27 it uses GGUF, but I also tried another workflow that uses the fluxdev model also with #27 fix but still got the same "expected scalar type Half but found BFloat16" . I don't think it's related to the right mode/vae/clip.

I know that workflow but never use it. Anyway, let me know if this workflow works for you: ady-pulid-flux-txt2img.json

Requested to load Flux Loading 1 new model loaded partially 14234.197129821778 15024.12890625 0 100%|██████████████████████████████████████████████████████████████████████████████████| 30/30 [01:08<00:00, 2.29s/it] Requested to load AutoencodingEngine Loading 1 new model loaded completely 0.0 159.87335777282715 True Prompt executed in 119.17 seconds

LE: BTW, for "expected scalar type Half but found BFloat16" error there is an opened issue here #15

Thank you for the workflow and for pointing me to the issue #15 that discusses "expected scalar type Half but found BFloat16" .
I tried your workflow but I still get "expected scalar type Half but found BFloat16" and I'm on the code for PR #27

@jorgelozano1980
Copy link

0%| | 0/40 [00:00<?, ?it/s]
!!! Exception during processing !!! forward_orig() takes from 7 to 9 positional arguments but 10 were given
Traceback (most recent call last):
File "D:\u01\stabilityMatrix\Data\Packages\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:\u01\stabilityMatrix\Data\Packages\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:\u01\stabilityMatrix\Data\Packages\ComfyUI\execution.py", line 169, in map_node_over_list
process_inputs(input_dict, i)
File "D:\u01\stabilityMatrix\Data\Packages\ComfyUI\execution.py", line 158, in process_inputs
results.append(getattr(obj, func)(**inputs))
File "D:\u01\stabilityMatrix\Data\Packages\ComfyUI\comfy_extras\nodes_custom_sampler.py", line 633, in sample
samples = guider.sample(noise.generate_noise(latent), latent_image, sampler, sigmas, denoise_mask=noise_mask, callback=callback, disable_pbar=disable_pbar, seed=noise.seed)
File "D:\u01\stabilityMatrix\Data\Packages\ComfyUI\comfy\samplers.py", line 740, in sample
output = self.inner_sample(noise, latent_image, device, sampler, sigmas, denoise_mask, callback, disable_pbar, seed)
File "D:\u01\stabilityMatrix\Data\Packages\ComfyUI\comfy\samplers.py", line 719, in inner_sample
samples = sampler.sample(self, sigmas, extra_args, callback, noise, latent_image, denoise_mask, disable_pbar)
File "D:\u01\stabilityMatrix\Data\Packages\ComfyUI\comfy\samplers.py", line 624, in sample
samples = self.sampler_function(model_k, noise, sigmas, extra_args=extra_args, callback=k_callback, disable=disable_pbar, **self.extra_options)
File "D:\u01\stabilityMatrix\Data\Packages\ComfyUI\venv\lib\site-packages\torch\utils_contextlib.py", line 116, in decorate_context
return func(*args, **kwargs)
File "D:\u01\stabilityMatrix\Data\Packages\ComfyUI\comfy\k_diffusion\sampling.py", line 689, in sample_dpmpp_2m
denoised = model(x, sigmas[i] * s_in, **extra_args)
File "D:\u01\stabilityMatrix\Data\Packages\ComfyUI\comfy\samplers.py", line 299, in call
out = self.inner_model(x, sigma, model_options=model_options, seed=seed)
File "D:\u01\stabilityMatrix\Data\Packages\ComfyUI\comfy\samplers.py", line 706, in call
return self.predict_noise(*args, **kwargs)
File "D:\u01\stabilityMatrix\Data\Packages\ComfyUI\comfy_extras\nodes_custom_sampler.py", line 545, in predict_noise
out = comfy.samplers.calc_cond_batch(self.inner_model, [negative_cond, middle_cond, self.conds.get("positive", None)], x, timestep, model_options)
File "D:\u01\stabilityMatrix\Data\Packages\ComfyUI\comfy\samplers.py", line 228, in calc_cond_batch
output = model.apply_model(input_x, timestep
, **c).chunk(batch_chunks)
File "D:\u01\stabilityMatrix\Data\Packages\ComfyUI\comfy\model_base.py", line 144, in apply_model
model_output = self.diffusion_model(xc, t, context=context, control=control, transformer_options=transformer_options, **extra_conds).float()
File "D:\u01\stabilityMatrix\Data\Packages\ComfyUI\venv\lib\site-packages\torch\nn\modules\module.py", line 1736, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "D:\u01\stabilityMatrix\Data\Packages\ComfyUI\venv\lib\site-packages\torch\nn\modules\module.py", line 1747, in _call_impl
return forward_call(*args, **kwargs)
File "D:\u01\stabilityMatrix\Data\Packages\ComfyUI\comfy\ldm\flux\model.py", line 181, in forward
out = self.forward_orig(img, img_ids, context, txt_ids, timestep, y, guidance, control, transformer_options)
TypeError: forward_orig() takes from 7 to 9 positional arguments but 10 were given

Prompt executed in 111.83 seconds

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

9 participants