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

UnboundLocalError: local variable 'h' referenced before assignment #72

Open
Yaiol opened this issue Jul 6, 2023 · 2 comments
Open

UnboundLocalError: local variable 'h' referenced before assignment #72

Yaiol opened this issue Jul 6, 2023 · 2 comments

Comments

@Yaiol
Copy link

Yaiol commented Jul 6, 2023

Automatic1111 startup options
--port 7800 --xformers --api --disable-safe-unpickle --skip-install

When using Sampler :
DPM++ 2M SDE
DPM++ 2M SDE Karras

Script X/Y/Z Plot with X defined as
Steps:1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,55,60,65,70,75,80,85,90,95,100

I get this error:

*** Error completing request | 1/2070 [00:02<1:14:01, 2.15s/it]
*** Arguments: ('task(psiv3pussxe3h92)', 'masterpiece, realistic, portrait of a girl, medieval armor, upper body, outdoors, far away castle, metal reflections, intense sunlight, dramatic, cinematic lighting, octane render, unreal engine', 'frame, bad anatomy, hand, hands', [], 20, 9, False, False, 1, 1, 7, 1587979927.0, -1.0, 0, 0, 0, False, 512, 512, False, 0.25, 2, 'A-ArtStation1337-4x-v2', 5, 0, 0, 0, '', '', [], 3, 0, 0, 0, 0, 0.25, False, True, False, False, 'LoRA', 'None', 1, 1, 'LoRA', 'None', 1, 1, 'LoRA', 'None', 1, 1, 'LoRA', 'None', 1, 1, 'LoRA', 'None', 1, 1, None, 'Refresh models', <scripts.controlnet_ui.controlnet_ui_group.UiControlNetUnit object at 0x00000231F51E19F0>, <scripts.controlnet_ui.controlnet_ui_group.UiControlNetUnit object at 0x00000231F51E31F0>, None, False, '0', 'D:\Apps\sd\sd-webui\repo\models\roop\inswapper_128.onnx', 'CodeFormer', 1, '', 1, 1, False, True, False, False, '', False, False, 'positive', 'comma', 0, 4, '1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,46,37,38,49,40,41,42,43,44,45,46,47,48,49,50,55,60,65,70,75,80,85,90,95,100', [], 0, '', [], 0, '', [], True, False, False, False, 0, None, None, False, None, None, False, 50) {}
Traceback (most recent call last):
File "D:\Apps\sd\sd-webui\repo\modules\call_queue.py", line 55, in f
res = list(func(*args, **kwargs))
File "D:\Apps\sd\sd-webui\repo\modules\call_queue.py", line 35, in f
res = func(*args, **kwargs)
File "D:\Apps\sd\sd-webui\repo\modules\txt2img.py", line 54, in txt2img
processed = modules.scripts.scripts_txt2img.run(p, *args)
File "D:\Apps\sd\sd-webui\repo\modules\scripts.py", line 456, in run
processed = script.run(p, *script_args)
File "D:\Apps\sd\sd-webui\repo\scripts\too_std-xyz.py", line 678, in run
processed = draw_xyz_grid(
File "D:\Apps\sd\sd-webui\repo\scripts\too_std-xyz.py", line 317, in draw_xyz_grid
process_cell(x, y, z, ix, iy, iz)
File "D:\Apps\sd\sd-webui\repo\scripts\too_std-xyz.py", line 260, in process_cell
processed: Processed = cell(x, y, z, ix, iy, iz)
File "D:\Apps\sd\sd-webui\repo\scripts\too_std-xyz.py", line 641, in cell
res = process_images(pc)
File "D:\Apps\sd\sd-webui\repo\modules\processing.py", line 620, in process_images
res = process_images_inner(p)
File "D:\Apps\sd\sd-webui\repo\extensions\sd-webui-controlnet\scripts\batch_hijack.py", line 42, in processing_process_images_hijack
return getattr(processing, '__controlnet_original_process_images_inner')(p, *args, **kwargs)
File "D:\Apps\sd\sd-webui\repo\modules\processing.py", line 739, in process_images_inner
samples_ddim = p.sample(conditioning=p.c, unconditional_conditioning=p.uc, seeds=p.seeds, subseeds=p.subseeds, subseed_strength=p.subseed_strength, prompts=p.prompts)
File "D:\Apps\sd\sd-webui\repo\modules\processing.py", line 992, in sample
samples = self.sampler.sample(self, x, conditioning, unconditional_conditioning, image_conditioning=self.txt2img_image_conditioning(x))
File "D:\Apps\sd\sd-webui\repo\modules\sd_samplers_kdiffusion.py", line 439, in sample
samples = self.launch_sampling(steps, lambda: self.func(self.model_wrap_cfg, x, extra_args={
File "D:\Apps\sd\sd-webui\repo\modules\sd_samplers_kdiffusion.py", line 278, in launch_sampling
return func()
File "D:\Apps\sd\sd-webui\repo\modules\sd_samplers_kdiffusion.py", line 439, in
samples = self.launch_sampling(steps, lambda: self.func(self.model_wrap_cfg, x, extra_args={
File "D:\Apps\sd\sd-webui\repo\venv\lib\site-packages\torch\utils_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "D:\Apps\sd\sd-webui\repo\repositories\k-diffusion\k_diffusion\sampling.py", line 650, in sample_dpmpp_2m_sde
h_last = h
UnboundLocalError: local variable 'h' referenced before assignment

I fixed it adding h = None in
\k-diffusion\k_diffusion\sampling.py
line 623

old_denoised = None
h = None
h_last = None
@Yucheng301
Copy link

same problem here, have you fixed it?

@ai-tnc
Copy link

ai-tnc commented Oct 18, 2023

yep same

      File "/stable-diffusion-webui/modules/sd_samplers_common.py", line 261, in launch_sampling
        return func()
      File "/stable-diffusion-webui/modules/sd_samplers_kdiffusion.py", line 235, in <lambda>
        samples = self.launch_sampling(steps, lambda: self.func(self.model_wrap_cfg, x, extra_args=self.sampler_extra_args, disable=False, callback=self.callback_state, **extra_params_kwargs))
      File "/usr/local/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
        return func(*args, **kwargs)
      File "/stable-diffusion-webui/repositories/k-diffusion/k_diffusion/sampling.py", line 651, in sample_dpmpp_2m_sde
        h_last = h
    UnboundLocalError: local variable 'h' referenced before assignment

ai-tnc pushed a commit to ai-tnc/k-diffusion that referenced this issue Oct 18, 2023
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

3 participants