[Bug]: Error when generating with 'Highres. fix' and 'Upscale latent space image when doing hires. fix'
HotChocut opened this issue · 13 comments
Is there an existing issue for this?
- I have searched the existing issues and checked the recent builds/commits
What happened?
Attempting to use 'Highres. fix' with 'Upscale latent space image when doing hires. fix' results in the error message "UnboundLocalError: local variable 'decoded_samples' referenced before assignment" when it attempts to do the second batch of steps in the console.
When trying to generate "a cat" using stable diffusion 1.5, console prints:
Error completing request4:21, 7.00it/s]
Arguments: ('a cat', '', 'None', 'None', 28, 0, False, False, 1, 1, 7, -1.0, -1.0, 0, 0, 0, False, 1024, 1024, True, 0.7, 0, 0, 0, False, False, None, '', 1, '', 0, '', True, False, False) {}
Traceback (most recent call last):
File "...\modules\ui.py", line 221, in f
res = list(func(*args, **kwargs))
File "...\webui.py", line 63, in f
res = func(*args, **kwargs)
File "...\modules\txt2img.py", line 48, in txt2img
processed = process_images(p)
File "...\modules\processing.py", line 426, in process_images
res = process_images_inner(p)
File "...\modules\processing.py", line 519, in process_images_inner
samples_ddim = p.sample(conditioning=c, unconditional_conditioning=uc, seeds=seeds, subseeds=subseeds, subseed_strength=p.subseed_strength)
File "...\modules\processing.py", line 688, in sample
decoded_samples,
UnboundLocalError: local variable 'decoded_samples' referenced before assignment
Steps to reproduce the problem
- Enable 'Upscale latent space image when doing hires. fix' in Settings
- Enable 'Highres. fix'
- Generate
What should have happened?
The image should have generated
Commit where the problem happens
What platforms do you use to access UI ?
Windows
What browsers do you use to access the UI ?
Google Chrome
I just encountered this bug as well. The problem is specifically when using the highres fix with the "Upscale latent space image when doing hires. fix" option ticked on the settings page. It seems that when that is checked, in the conditional beginning at
stable-diffusion-webui/modules/processing.py
Line 654 in 78b879b
the later-referenced variable
decoded_samples
is indeed never set in the true branch.+1 seeing this as well, looks like the bug was introduced in this commit 26a3fd2
Specifically caused by enabling Scale Latent
Yeah just tried it without scaling latent space and it worked, I'll update the issue to include that
+1, I also just ran into this problem.
Same issue here. Log:
Traceback (most recent call last):
File "C:\Users\user\Desktop\automatic1111\modules\ui.py", line 185, in f
res = list(func(*args, **kwargs))
File "C:\Users\user\Desktop\automatic1111\webui.py", line 63, in f
res = func(*args, **kwargs)
File "C:\Users\user\Desktop\automatic1111\modules\txt2img.py", line 48, in txt2img
processed = process_images(p)
File "C:\Users\user\Desktop\automatic1111\modules\processing.py", line 426, in process_images
res = process_images_inner(p)
File "C:\Users\user\Desktop\automatic1111\modules\processing.py", line 519, in process_images_inner
samples_ddim = p.sample(conditioning=c, unconditional_conditioning=uc, seeds=seeds, subseeds=subseeds, subseed_strength=p.subseed_strength)
File "C:\Users\user\Desktop\automatic1111\modules\processing.py", line 688, in sample
decoded_samples,
UnboundLocalError: local variable 'decoded_samples' referenced before assignment
Also have this issue, same error above.
I also have this issue.
Yeah just tried it without scaling latent space and it worked, I'll update the issue to include that
Scale latent has been essential for higher quality generations. Is there a way to fix this without removing it?
Temporary fix is to just revert to commit a0a7024
Sorry everyone, this was as a result of my recent change.
Thank you @rocketgarden for finding the OOS variable.
Adding a pull request in to fix this.
Temporary fix is to just revert to commit a0a7024c679056dd66beb1832e52041b10143130
Originally posted by @rocketgarden in #3888 (comment)
Non help it
Any ETA on when this will be solved?