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

[Bug]: Fooocus 2.4.2 TCD broken - not working #3099

Closed
5 tasks
k8kiss opened this issue Jun 5, 2024 · 5 comments · Fixed by #3106
Closed
5 tasks

[Bug]: Fooocus 2.4.2 TCD broken - not working #3099

k8kiss opened this issue Jun 5, 2024 · 5 comments · Fixed by #3106
Labels
bug Something isn't working triage This needs an (initial) review

Comments

@k8kiss
Copy link

k8kiss commented Jun 5, 2024

Checklist

  • The issue has not been resolved by following the troubleshooting guide
  • The issue exists on a clean installation of Fooocus
  • The issue exists in the current version of Fooocus
  • The issue has not been reported before recently
  • The issue has been reported before but has not been fixed yet

What happened?

It doesn't start the image generation

Steps to reproduce the problem

[Fooocus Model Management] Moving model(s) has taken 1.14 seconds
Traceback (most recent call last):
File "G:\foocus_OG\Fooocus\modules\async_worker.py", line 998, in worker
handler(task)
File "G:\foocus_OG\python_embeded\lib\site-packages\torch\utils_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "G:\foocus_OG\python_embeded\lib\site-packages\torch\utils_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "G:\foocus_OG\Fooocus\modules\async_worker.py", line 888, in handler
imgs = pipeline.process_diffusion(
File "G:\foocus_OG\python_embeded\lib\site-packages\torch\utils_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "G:\foocus_OG\python_embeded\lib\site-packages\torch\utils_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "G:\foocus_OG\Fooocus\modules\default_pipeline.py", line 379, in process_diffusion
sampled_latent = core.ksampler(
File "G:\foocus_OG\python_embeded\lib\site-packages\torch\utils_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "G:\foocus_OG\python_embeded\lib\site-packages\torch\utils_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "G:\foocus_OG\Fooocus\modules\core.py", line 310, in ksampler
samples = ldm_patched.modules.sample.sample(model,
File "G:\foocus_OG\Fooocus\ldm_patched\modules\sample.py", line 100, in sample
samples = sampler.sample(noise, positive_copy, negative_copy, cfg=cfg, latent_image=latent_image, start_step=start_step, last_step=last_step, force_full_denoise=force_full_denoise, denoise_mask=noise_mask, sigmas=sigmas, callback=callback, disable_pbar=disable_pbar, seed=seed)
File "G:\foocus_OG\Fooocus\ldm_patched\modules\samplers.py", line 712, in sample
return sample(self.model, noise, positive, negative, cfg, self.device, sampler, sigmas, self.model_options, latent_image=latent_image, denoise_mask=denoise_mask, callback=callback, disable_pbar=disable_pbar, seed=seed)
File "G:\foocus_OG\python_embeded\lib\site-packages\torch\utils_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "G:\foocus_OG\python_embeded\lib\site-packages\torch\utils_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "G:\foocus_OG\Fooocus\modules\sample_hijack.py", line 158, in sample_hacked
samples = sampler.sample(model_wrap, sigmas, extra_args, callback_wrap, noise, latent_image, denoise_mask, disable_pbar)
File "G:\foocus_OG\Fooocus\ldm_patched\modules\samplers.py", line 557, in sample
samples = self.sampler_function(model_k, noise, sigmas, extra_args=extra_args, callback=k_callback, disable=disable_pbar, **self.extra_options)
File "G:\foocus_OG\python_embeded\lib\site-packages\torch\utils_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "G:\foocus_OG\Fooocus\ldm_patched\k_diffusion\sampling.py", line 821, in sample_tcd
alpha_prod_s = model_sampling.alphas_cumprod[timesteps_s]
File "G:\foocus_OG\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}'")
AttributeError: 'ModelSampling' object has no attribute 'alphas_cumprod'

What should have happened?

Generate image

What browsers do you use to access Fooocus?

Google Chrome

Where are you running Fooocus?

Locally

What operating system are you using?

Windows 11

Console logs

[Fooocus Model Management] Moving model(s) has taken 1.14 seconds
Traceback (most recent call last):
  File "G:\foocus_OG\Fooocus\modules\async_worker.py", line 998, in worker
    handler(task)
  File "G:\foocus_OG\python_embeded\lib\site-packages\torch\utils\_contextlib.py", line 115, in decorate_context
    return func(*args, **kwargs)
  File "G:\foocus_OG\python_embeded\lib\site-packages\torch\utils\_contextlib.py", line 115, in decorate_context
    return func(*args, **kwargs)
  File "G:\foocus_OG\Fooocus\modules\async_worker.py", line 888, in handler
    imgs = pipeline.process_diffusion(
  File "G:\foocus_OG\python_embeded\lib\site-packages\torch\utils\_contextlib.py", line 115, in decorate_context
    return func(*args, **kwargs)
  File "G:\foocus_OG\python_embeded\lib\site-packages\torch\utils\_contextlib.py", line 115, in decorate_context
    return func(*args, **kwargs)
  File "G:\foocus_OG\Fooocus\modules\default_pipeline.py", line 379, in process_diffusion
    sampled_latent = core.ksampler(
  File "G:\foocus_OG\python_embeded\lib\site-packages\torch\utils\_contextlib.py", line 115, in decorate_context
    return func(*args, **kwargs)
  File "G:\foocus_OG\python_embeded\lib\site-packages\torch\utils\_contextlib.py", line 115, in decorate_context
    return func(*args, **kwargs)
  File "G:\foocus_OG\Fooocus\modules\core.py", line 310, in ksampler
    samples = ldm_patched.modules.sample.sample(model,
  File "G:\foocus_OG\Fooocus\ldm_patched\modules\sample.py", line 100, in sample
    samples = sampler.sample(noise, positive_copy, negative_copy, cfg=cfg, latent_image=latent_image, start_step=start_step, last_step=last_step, force_full_denoise=force_full_denoise, denoise_mask=noise_mask, sigmas=sigmas, callback=callback, disable_pbar=disable_pbar, seed=seed)
  File "G:\foocus_OG\Fooocus\ldm_patched\modules\samplers.py", line 712, in sample
    return sample(self.model, noise, positive, negative, cfg, self.device, sampler, sigmas, self.model_options, latent_image=latent_image, denoise_mask=denoise_mask, callback=callback, disable_pbar=disable_pbar, seed=seed)
  File "G:\foocus_OG\python_embeded\lib\site-packages\torch\utils\_contextlib.py", line 115, in decorate_context
    return func(*args, **kwargs)
  File "G:\foocus_OG\python_embeded\lib\site-packages\torch\utils\_contextlib.py", line 115, in decorate_context
    return func(*args, **kwargs)
  File "G:\foocus_OG\Fooocus\modules\sample_hijack.py", line 158, in sample_hacked
    samples = sampler.sample(model_wrap, sigmas, extra_args, callback_wrap, noise, latent_image, denoise_mask, disable_pbar)
  File "G:\foocus_OG\Fooocus\ldm_patched\modules\samplers.py", line 557, in sample
    samples = self.sampler_function(model_k, noise, sigmas, extra_args=extra_args, callback=k_callback, disable=disable_pbar, **self.extra_options)
  File "G:\foocus_OG\python_embeded\lib\site-packages\torch\utils\_contextlib.py", line 115, in decorate_context
    return func(*args, **kwargs)
  File "G:\foocus_OG\Fooocus\ldm_patched\k_diffusion\sampling.py", line 821, in sample_tcd
    alpha_prod_s = model_sampling.alphas_cumprod[timesteps_s]
  File "G:\foocus_OG\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}'")
AttributeError: 'ModelSampling' object has no attribute 'alphas_cumprod'

Additional information

no

@k8kiss k8kiss added bug Something isn't working triage This needs an (initial) review labels Jun 5, 2024
@k8kiss
Copy link
Author

k8kiss commented Jun 5, 2024

Looks like this happens when choosing tcd sampler, I've been using it since 2.4.1 included it and really like it. I am not sure why is now broken.

Also this new version is super slow! Any way to go back to 2.41? I didn't back up.

@kurttu4
Copy link

kurttu4 commented Jun 6, 2024

add in .\Fooocus\modules\patch_precision.py
55 self.alphas_cumprod = alphas_cumprod

@k8kiss
Copy link
Author

k8kiss commented Jun 6, 2024

add in .\Fooocus\modules\patch_precision.py 55 self.alphas_cumprod = alphas_cumprod
Actuallly it goes after "self.set_sigmas(sigmas)" before RETURN so line 53 Otherwise you get:
NameError: name 'alphas_cumprod' is not defined
However it is still not working. Selecting tcd sampler:

unload clone 3 [Fooocus Model Management] Moving model(s) has taken 15.57 seconds 0%| | 0/15 [00:01<?, ?it/s] Traceback (most recent call last): File "G:\foocus_OG\Fooocus\modules\async_worker.py", line 998, in worker handler(task) File "G:\foocus_OG\python_embeded\lib\site-packages\torch\utils\_contextlib.py", line 115, in decorate_context return func(*args, **kwargs) File "G:\foocus_OG\python_embeded\lib\site-packages\torch\utils\_contextlib.py", line 115, in decorate_context return func(*args, **kwargs) File "G:\foocus_OG\Fooocus\modules\async_worker.py", line 888, in handler imgs = pipeline.process_diffusion( File "G:\foocus_OG\python_embeded\lib\site-packages\torch\utils\_contextlib.py", line 115, in decorate_context return func(*args, **kwargs) File "G:\foocus_OG\python_embeded\lib\site-packages\torch\utils\_contextlib.py", line 115, in decorate_context return func(*args, **kwargs) File "G:\foocus_OG\Fooocus\modules\default_pipeline.py", line 379, in process_diffusion sampled_latent = core.ksampler( File "G:\foocus_OG\python_embeded\lib\site-packages\torch\utils\_contextlib.py", line 115, in decorate_context return func(*args, **kwargs) File "G:\foocus_OG\python_embeded\lib\site-packages\torch\utils\_contextlib.py", line 115, in decorate_context return func(*args, **kwargs) File "G:\foocus_OG\Fooocus\modules\core.py", line 310, in ksampler samples = ldm_patched.modules.sample.sample(model, File "G:\foocus_OG\Fooocus\ldm_patched\modules\sample.py", line 100, in sample samples = sampler.sample(noise, positive_copy, negative_copy, cfg=cfg, latent_image=latent_image, start_step=start_step, last_step=last_step, force_full_denoise=force_full_denoise, denoise_mask=noise_mask, sigmas=sigmas, callback=callback, disable_pbar=disable_pbar, seed=seed) File "G:\foocus_OG\Fooocus\ldm_patched\modules\samplers.py", line 712, in sample return sample(self.model, noise, positive, negative, cfg, self.device, sampler, sigmas, self.model_options, latent_image=latent_image, denoise_mask=denoise_mask, callback=callback, disable_pbar=disable_pbar, seed=seed) File "G:\foocus_OG\python_embeded\lib\site-packages\torch\utils\_contextlib.py", line 115, in decorate_context return func(*args, **kwargs) File "G:\foocus_OG\python_embeded\lib\site-packages\torch\utils\_contextlib.py", line 115, in decorate_context return func(*args, **kwargs) File "G:\foocus_OG\Fooocus\modules\sample_hijack.py", line 158, in sample_hacked samples = sampler.sample(model_wrap, sigmas, extra_args, callback_wrap, noise, latent_image, denoise_mask, disable_pbar) File "G:\foocus_OG\Fooocus\ldm_patched\modules\samplers.py", line 557, in sample samples = self.sampler_function(model_k, noise, sigmas, extra_args=extra_args, callback=k_callback, disable=disable_pbar, **self.extra_options) File "G:\foocus_OG\python_embeded\lib\site-packages\torch\utils\_contextlib.py", line 115, in decorate_context return func(*args, **kwargs) File "G:\foocus_OG\Fooocus\ldm_patched\k_diffusion\sampling.py", line 826, in sample_tcd denoised = alpha_prod_s[i + 1].sqrt() * denoised + beta_prod_s[i + 1].sqrt() * eps AttributeError: 'numpy.float64' object has no attribute 'sqrt'

@mashb1t
Copy link
Collaborator

mashb1t commented Jun 6, 2024

Looks like this happens when choosing tcd sampler, I've been using it since 2.4.1 included it and really like it. I am not sure why is now broken.

Also this new version is super slow! Any way to go back to 2.41? I didn't back up.

we really need more tests, it's hard to keep track of everything. Will check in a few hours again. Probably it's only this one method being called for TCD, tested everything else and for speed nothing shzld have changed as there were no substantial changes for the sampling and pipeline.

@mashb1t mashb1t changed the title [Bug]: Fooocus 2.4.2 Broken - not working [Bug]: Fooocus 2.4.2 TCD broken - not working Jun 6, 2024
@mashb1t
Copy link
Collaborator

mashb1t commented Jun 6, 2024

Fixed in main, please restart Fooocus.
See #3106

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage This needs an (initial) review
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants