sd-dynamic-prompts icon indicating copy to clipboard operation
sd-dynamic-prompts copied to clipboard

Issue: AttributeError: 'StableDiffusionProcessingTxt2Img' object has no attribute 'hr_prompt'

Open brknsoul opened this issue 2 years ago • 8 comments

I get this error while generating;

11:28:48-170632 ERROR    Running script process:
                         E:\automatic\extensions\sd-dynamic-prompts\scripts\dynamic_prompting.py: AttributeError
┌───────────────────────────────────────── Traceback (most recent call last) ─────────────────────────────────────────┐
│ E:\automatic\modules\scripts.py:406 in process                                                                      │
│                                                                                                                     │
│   405 │   │   │   │   args = p.per_script_args.get(script.title(), p.script_args[script.args_f                      │
│ > 406 │   │   │   │   script.process(p, *args, **kwargs)                                                            │
│   407 │   │   │   │   s.append(f'{script.title()}:{round(time.time()-t0, 2)}s')                                     │
│                                                                                                                     │
│ E:\automatic\extensions\sd-dynamic-prompts\sd_dynamic_prompts\dynamic_prompting.py:400 in process                   │
│                                                                                                                     │
│   399 │   │   if hr_fix_enabled and hasattr(p, "all_hr_prompts"):                                                   │
│ > 400 │   │   │   original_hr_prompt = _get_effective_prompt(p.all_hr_prompts, p.hr_prompt)                         │
│   401 │   │   │   original_negative_hr_prompt = _get_effective_prompt(                                              │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
AttributeError: 'StableDiffusionProcessingTxt2Img' object has no attribute 'hr_prompt'
Starting SD.Next
Python 3.10.11 on Windows
Version: 45d50bd1 Wed Jul 5 00:12:07 2023 +0300
Latest published version: 422c60c78771fc927e20884466a43152edbcdcf6 2023-07-05T17:49:39Z
Using DirectML Backend
Torch 2.0.1+cpu
Torch backend: DirectML (torch-directml 0.2.0.dev230426)
Torch detected GPU: AMD Radeon RX 6600 XT

Win10, Chrome.

brknsoul avatar Jul 06 '23 02:07 brknsoul

I'm also seeing the same error:

19:00:16-103063 ERROR    Running script process:
      D:\AiApps\StableDiffusion\sd-vladmandic\extensions\sd-dynamic-prompts\scripts\dynamic_prompting.py: AttributeError

D:\AiApps\StableDiffusion\sd-vladmandic\modules\scripts.py:406 in process 

   405 │   │   │   │   args = p.per_script_args.get(script.title(), p.script_args[script.args_f
 ❱ 406 │   │   │   │   script.process(p, *args, **kwargs) 
   407 │   │   │   │   s.append(f'{script.title()}:{round(time.time()-t0, 2)}s')

D:\AiApps\StableDiffusion\sd-vladmandic\extensions\sd-dynamic-prompts\sd_dynamic_prompts\dynamic_prompting.py:400 in process  

   399 │   │   if hr_fix_enabled and hasattr(p, "all_hr_prompts"): 
 ❱ 400 │   │   │   original_hr_prompt = _get_effective_prompt(p.all_hr_prompts, p.hr_prompt) 
   401 │   │   │   original_negative_hr_prompt = _get_effective_prompt( 

AttributeError: 'StableDiffusionProcessingTxt2Img' object has no attribute 'hr_prompt'

Windows 11 Pro Chrome 114 & Firefox 115 Python 3.10.11 on Windows Version: d915d8d6 Sun Jul 9 03:09:37 2023 +0300 nVidia CUDA toolkit detected Torch 2.0.1+cu118 Torch backend: nVidia CUDA 11.8 cuDNN 8902 Torch detected GPU: NVIDIA GeForce RTX 4090 VRAM 24564 Arch (8, 9) Cores 128

afbagwell avatar Jul 09 '23 02:07 afbagwell

I wanted to provide a little more context. This error is only showing up for me when I have it enabled while also running AfterDetailer: https://github.com/Bing-su/adetailer

If the AfterDetailer settings, the scripts that are run by ADetailer are set to:

dynamic_prompting,dynamic_thresholding,wildcard_recursive,wildcards

Also, not sure if this makes a difference, but the error is occurring even when dynamic prompts are enabled but there are no dynamic variables/wildcards in my prompt.

The dynamic thresholding extension is disabled when the error pops up.

afbagwell avatar Jul 09 '23 16:07 afbagwell

I think this issue might have been fixed in ADetailer - @brknsoul @afbagwell could you confirm whether this is still an issue?

adieyal avatar Aug 13 '23 19:08 adieyal

I just tried with latest version of everything and the error is still there.

afbagwell avatar Aug 14 '23 01:08 afbagwell

can confirm, error still there

ViolentVotan avatar Aug 22 '23 21:08 ViolentVotan

still happening to me.

for temporary workaround, I modified my local dynamic_prompting.py like this:

407th line: original_hr_prompt = _get_effective_prompt(p.all_hr_prompts, p.hr_prompt if hasattr(p, "hr_prompt") else p.prompt)

410th line: p.hr_negative_prompt if hasattr(p, "hr_negative_prompt") else p.negative_prompt

then I could run adetailer, sd-dynamic-prompts, and second pass(hi-res fix) on SD.Next.

unfortunatelly, I don't understand how stable diffusion code works and which parameter means which, so consider this temporary solution until we have proper fix. (this is why I'm not making this into pull request)

jjmenet avatar Aug 31 '23 10:08 jjmenet

I tried jjmenet's work-around and that appears to have solved the issue for me. @adieyal Can this be reviewed for correctness and incorporated into the next release?

afbagwell avatar Sep 01 '23 14:09 afbagwell

I got a similar error AttributeError: 'StableDiffusionProcessingImg2Img' object has no attribute 'all_hr_prompts'

I have no idea

RandomTurtle avatar May 14 '24 16:05 RandomTurtle