automatic icon indicating copy to clipboard operation
automatic copied to clipboard

[Issue]: Regional prompt not working "AttributeError: 'Combine' object has no attribute 'set_parse_action'"

Open Bercraft opened this issue 1 year ago • 2 comments
trafficstars

Issue Description

When trying to use RegionalPrompt from script even after clean install or with different checkpoints it always gives error

Version Platform Description

Firefox,windows,zluda,radeon 5700 pro, threadripper 1920x

Relevant log output

13:20:02-592599 INFO     Select: model="pppAnimix_v20 [1797143615]"
13:20:02-598599 INFO     Loading VAE: model=G:\models\VAE\PPPAnimixVAE_v3.safetensors source=settings
13:20:02-602598 INFO     Autodetect: vae="Stable Diffusion" class=StableDiffusionPipeline
                         file="G:\models\Stable-diffusion\pppAnimix_v20.safetensors" size=2034MB
13:20:03-075555 INFO     Autodetect: model="Stable Diffusion" class=StableDiffusionPipeline
                         file="G:\models\Stable-diffusion\pppAnimix_v20.safetensors" size=2034MB
Fetching 11 files: 100%|███████████████████████████████████████████████████████████████████████| 11/11 [00:00<?, ?it/s]
Loading pipeline components... 100% ----------------------------------------------- 6/6  [ 0:00:00 < 0:00:00 , 14 C/s ]

13:20:06-186979 INFO     Load embeddings: loaded=34 skipped=7 time=2.54
tag_autocomplete_helper: Old webui version or unrecognized model shape, using fallback for embedding completion.
13:20:09-030399 INFO     Load model: time=6.06 load=1.05 embeddings=2.54 move=2.45 native=512 {'ram': {'used': 1.66,
                         'total': 31.88}, 'gpu': {'used': 2.21, 'total': 7.98}, 'retries': 0, 'oom': 0}
13:20:09-303474 INFO     Base: class=RegionalPromptingStableDiffusionPipeline
13:20:09-331064 ERROR    Exception: 'Combine' object has no attribute 'set_parse_action'
13:20:09-334048 ERROR    Arguments: args=('task(xi0zxzsguat2tce)', 'masterpiece, best quality, high quality, highres,
                         detailed, realistic,duo, 2girls, park, walking ADDCOMM\n1girl, long hair, black hair, dress,
                         walking,  BREAK\n1girl, short hair, blonde hair, dark skin, walking, \n', 'worst quality, low
                         quality, normal quality, unfinished, aliasing,  an14 BREAK\ndark skin, blonde hair,
                         BREAK\nwhite skin,black hair, ', [], 20, 4, 26, True, False, False, False, 1, 1, 6, 6, 0.7, 0,
                         0.5, 1, 1, -1.0, -1.0, 0, 0, 0, 768, 768, False, 0.3, 2, 'None', False, 20, 0, 0, 10, 0, '',
                         '', 0, 0, 0, 0, False, 4, 0.95, False, 0.6, 1, '#000000', 0, [], 8, 1, 'None', 'None', 'None',
                         'None', 0.5, 0.5, 0.5, 0.5, None, None, None, None, 0, 0, 0, 0, 1, 1, 1, 1, None, None, None,
                         None, False, '', 'None', 16, 'None', 1, True, 'None', 2, True, 1, 0, True, 'none', 3, 4, 0.25,
                         0.25, False, False, {'ad_model': 'face_yolov8n.pt', 'ad_model_classes': '', 'ad_tab_enable':
                         True, 'ad_prompt': '', 'ad_negative_prompt': '', 'ad_confidence': 0.3, 'ad_mask_k_largest': 0,
                         'ad_mask_min_ratio': 0, 'ad_mask_max_ratio': 1, 'ad_x_offset': 0, 'ad_y_offset': 0,
                         'ad_dilate_erode': 4, 'ad_mask_merge_invert': 'None', 'ad_mask_blur': 4,
                         'ad_denoising_strength': 0.4, 'ad_inpaint_only_masked': True,
                         'ad_inpaint_only_masked_padding': 32, 'ad_use_inpaint_width_height': False,
                         'ad_inpaint_width': 512, 'ad_inpaint_height': 512, 'ad_use_steps': False, 'ad_steps': 28,
                         'ad_use_cfg_scale': False, 'ad_cfg_scale': 7, 'ad_use_checkpoint': False, 'ad_checkpoint':
                         'Use same checkpoint', 'ad_use_vae': False, 'ad_vae': 'Use same VAE', 'ad_use_sampler': False,
                         'ad_sampler': 'Default', 'ad_scheduler': 'Use same scheduler', 'ad_use_noise_multiplier':
                         False, 'ad_noise_multiplier': 1, 'ad_use_clip_skip': False, 'ad_clip_skip': 1,
                         'ad_restore_face': False, 'ad_controlnet_model': 'None', 'ad_controlnet_module': 'None',
                         'ad_controlnet_weight': 1, 'ad_controlnet_guidance_start': 0, 'ad_controlnet_guidance_end': 1,
                         'is_api': ()}, {'ad_model': 'None', 'ad_model_classes': '', 'ad_tab_enable': True,
                         'ad_prompt': '', 'ad_negative_prompt': '', 'ad_confidence': 0.3, 'ad_mask_k_largest': 0,
                         'ad_mask_min_ratio': 0, 'ad_mask_max_ratio': 1, 'ad_x_offset': 0, 'ad_y_offset': 0,
                         'ad_dilate_erode': 4, 'ad_mask_merge_invert': 'None', 'ad_mask_blur': 4,
                         'ad_denoising_strength': 0.4, 'ad_inpaint_only_masked': True,
                         'ad_inpaint_only_masked_padding': 32, 'ad_use_inpaint_width_height': False,
                         'ad_inpaint_width': 512, 'ad_inpaint_height': 512, 'ad_use_steps': False, 'ad_steps': 28,
                         'ad_use_cfg_scale': False, 'ad_cfg_scale': 7, 'ad_use_checkpoint': False, 'ad_checkpoint':
                         'Use same checkpoint', 'ad_use_vae': False, 'ad_vae': 'Use same VAE', 'ad_use_sampler': False,
                         'ad_sampler': 'Default', 'ad_scheduler': 'Use same scheduler', 'ad_use_noise_multiplier':
                         False, 'ad_noise_multiplier': 1, 'ad_use_clip_skip': False, 'ad_clip_skip': 1,
                         'ad_restore_face': False, 'ad_controlnet_model': 'None', 'ad_controlnet_module': 'None',
                         'ad_controlnet_weight': 1, 'ad_controlnet_guidance_start': 0, 'ad_controlnet_guidance_end': 1,
                         'is_api': ()}, {'ad_model': 'None', 'ad_model_classes': '', 'ad_tab_enable': True,
                         'ad_prompt': '', 'ad_negative_prompt': '', 'ad_confidence': 0.3, 'ad_mask_k_largest': 0,
                         'ad_mask_min_ratio': 0, 'ad_mask_max_ratio': 1, 'ad_x_offset': 0, 'ad_y_offset': 0,
                         'ad_dilate_erode': 4, 'ad_mask_merge_invert': 'None', 'ad_mask_blur': 4,
                         'ad_denoising_strength': 0.4, 'ad_inpaint_only_masked': True,
                         'ad_inpaint_only_masked_padding': 32, 'ad_use_inpaint_width_height': False,
                         'ad_inpaint_width': 512, 'ad_inpaint_height': 512, 'ad_use_steps': False, 'ad_steps': 28,
                         'ad_use_cfg_scale': False, 'ad_cfg_scale': 7, 'ad_use_checkpoint': False, 'ad_checkpoint':
                         'Use same checkpoint', 'ad_use_vae': False, 'ad_vae': 'Use same VAE', 'ad_use_sampler': False,
                         'ad_sampler': 'Default', 'ad_scheduler': 'Use same scheduler', 'ad_use_noise_multiplier':
                         False, 'ad_noise_multiplier': 1, 'ad_use_clip_skip': False, 'ad_clip_skip': 1,
                         'ad_restore_face': False, 'ad_controlnet_model': 'None', 'ad_controlnet_module': 'None',
                         'ad_controlnet_weight': 1, 'ad_controlnet_guidance_start': 0, 'ad_controlnet_guidance_end': 1,
                         'is_api': ()}, {'ad_model': 'None', 'ad_model_classes': '', 'ad_tab_enable': True,
                         'ad_prompt': '', 'ad_negative_prompt': '', 'ad_confidence': 0.3, 'ad_mask_k_largest': 0,
                         'ad_mask_min_ratio': 0, 'ad_mask_max_ratio': 1, 'ad_x_offset': 0, 'ad_y_offset': 0,
                         'ad_dilate_erode': 4, 'ad_mask_merge_invert': 'None', 'ad_mask_blur': 4,
                         'ad_denoising_strength': 0.4, 'ad_inpaint_only_masked': True,
                         'ad_inpaint_only_masked_padding': 32, 'ad_use_inpaint_width_height': False,
                         'ad_inpaint_width': 512, 'ad_inpaint_height': 512, 'ad_use_steps': False, 'ad_steps': 28,
                         'ad_use_cfg_scale': False, 'ad_cfg_scale': 7, 'ad_use_checkpoint': False, 'ad_checkpoint':
                         'Use same checkpoint', 'ad_use_vae': False, 'ad_vae': 'Use same VAE', 'ad_use_sampler': False,
                         'ad_sampler': 'Default', 'ad_scheduler': 'Use same scheduler', 'ad_use_noise_multiplier':
                         False, 'ad_noise_multiplier': 1, 'ad_use_clip_skip': False, 'ad_clip_skip': 1,
                         'ad_restore_face': False, 'ad_controlnet_model': 'None', 'ad_controlnet_module': 'None',
                         'ad_controlnet_weight': 1, 'ad_controlnet_guidance_start': 0, 'ad_controlnet_guidance_end': 1,
                         'is_api': ()}, {'ad_model': 'None', 'ad_model_classes': '', 'ad_tab_enable': True,
                         'ad_prompt': '', 'ad_negative_prompt': '', 'ad_confidence': 0.3, 'ad_mask_k_largest': 0,
                         'ad_mask_min_ratio': 0, 'ad_mask_max_ratio': 1, 'ad_x_offset': 0, 'ad_y_offset': 0,
                         'ad_dilate_erode': 4, 'ad_mask_merge_invert': 'None', 'ad_mask_blur': 4,
                         'ad_denoising_strength': 0.4, 'ad_inpaint_only_masked': True,
                         'ad_inpaint_only_masked_padding': 32, 'ad_use_inpaint_width_height': False,
                         'ad_inpaint_width': 512, 'ad_inpaint_height': 512, 'ad_use_steps': False, 'ad_steps': 28,
                         'ad_use_cfg_scale': False, 'ad_cfg_scale': 7, 'ad_use_checkpoint': False, 'ad_checkpoint':
                         'Use same checkpoint', 'ad_use_vae': False, 'ad_vae': 'Use same VAE', 'ad_use_sampler': False,
                         'ad_sampler': 'Default', 'ad_scheduler': 'Use same scheduler', 'ad_use_noise_multiplier':
                         False, 'ad_noise_multiplier': 1, 'ad_use_clip_skip': False, 'ad_clip_skip': 1,
                         'ad_restore_face': False, 'ad_controlnet_model': 'None', 'ad_controlnet_module': 'None',
                         'ad_controlnet_weight': 1, 'ad_controlnet_guidance_start': 0, 'ad_controlnet_guidance_end': 1,
                         'is_api': ()}, 3, 1, 1, 0.8, 8, 64, True, True, 0.5, 600.0, 1.0, 1, 1, 0.5, 0.5,
                         'OpenGVLab/InternVL-14B-224px', False, False, 'positive', 'comma', 0, False, False, '',
                         'Columns', '1,1', 1, '', 'None', 1, True, 10, 'None', True, 0, 'None', 2, True, 1, 0, 0, '',
                         [], 0, '', [], 0, '', [], False, True, False, False, False, False, 0, 'None', [], 'FaceID
                         Base', True, True, 1, 1, 1, 0.5, False, 'person', 1, 0.5, True) kwargs={}
13:20:09-604901 ERROR    gradio call: AttributeError
┌───────────────────────────────────────── Traceback (most recent call last) ─────────────────────────────────────────┐
│ G:\automatic\modules\call_queue.py:31 in f                                                                          │
│                                                                                                                     │
│   30 │   │   │   try:                                                                                               │
│ > 31 │   │   │   │   res = func(*args, **kwargs)                                                                    │
│   32 │   │   │   │   progress.record_results(id_task, res)                                                          │
│                                                                                                                     │
│ G:\automatic\modules\txt2img.py:89 in txt2img                                                                       │
│                                                                                                                     │
│   88 │   p.script_args = args                                                                                       │
│ > 89 │   processed = scripts.scripts_txt2img.run(p, *args)                                                          │
│   90 │   if processed is None:                                                                                      │
│                                                                                                                     │
│ G:\automatic\modules\scripts.py:483 in run                                                                          │
│                                                                                                                     │
│   482 │   │   parsed = p.per_script_args.get(script.title(), args[script.args_from:script.args_to])                 │
│ > 483 │   │   processed = script.run(p, *parsed)                                                                    │
│   484 │   │   s.record(script.title())                                                                              │
│                                                                                                                     │
│ G:\automatic\scripts\regional_prompting.py:83 in run                                                                │
│                                                                                                                     │
│   82 │   │   shared.log.debug(f'Regional: args={p.task_args}')                                                      │
│ > 83 │   │   processed: processing.Processed = processing.process_images(p) # runs processing using main loop       │
│   84                                                                                                                │
│                                                                                                                     │
│ G:\automatic\modules\processing.py:191 in process_images                                                            │
│                                                                                                                     │
│   190 │   │   │   with context_hypertile_vae(p), context_hypertile_unet(p):                                         │
│ > 191 │   │   │   │   processed = process_images_inner(p)                                                           │
│   192                                                                                                               │
│                                                                                                                     │
│                                               ... 4 frames hidden ...                                               │
│                                                                                                                     │
│ C:\Users\aless\.cache\huggingface\modules\diffusers_modules\git\regional_prompting_stable_diffusion.py:135 in getco │
│                                                                                                                     │
│   134 │   │   │   │   for prp in prps:                                                                              │
│ > 135 │   │   │   │   │   embl.append(compel.build_conditioning_tensor(prp))                                        │
│   136 │   │   │   │   return torch.cat(embl)                                                                        │
│                                                                                                                     │
│ G:\automatic\venv\lib\site-packages\compel\compel.py:111 in build_conditioning_tensor                               │
│                                                                                                                     │
│   110 │   │   """                                                                                                   │
│ > 111 │   │   conjunction = self.parse_prompt_string(text)                                                          │
│   112 │   │   conditioning, _ = self.build_conditioning_tensor_for_conjunction(conjunction)                         │
│                                                                                                                     │
│ G:\automatic\venv\lib\site-packages\compel\compel.py:157 in parse_prompt_string                                     │
│                                                                                                                     │
│   156 │   │   """                                                                                                   │
│ > 157 │   │   pp = PromptParser()                                                                                   │
│   158 │   │   conjunction = pp.parse_conjunction(prompt_string)                                                     │
│                                                                                                                     │
│ G:\automatic\venv\lib\site-packages\compel\prompt_parser.py:314 in __init__                                         │
│                                                                                                                     │
│   313 │   │                                                                                                         │
│ > 314 │   │   self.conjunction, self.prompt = build_parser_syntax(attention_plus_base, attention_minus_base)        │
│   315                                                                                                               │
│                                                                                                                     │
│ G:\automatic\venv\lib\site-packages\compel\prompt_parser.py:531 in build_parser_syntax                              │
│                                                                                                                     │
│   530 │   number = pp.pyparsing_common.real | \                                                                     │
│ > 531 │   │   │    pp.Combine(pp.Optional("-")+pp.Word(pp.nums)).set_parse_action(pp.token_map(float))              │
│   532 │   non_float_number = pp.Combine(pp.Optional("-") + pp.Word(pp.nums))                                        │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
AttributeError: 'Combine' object has no attribute 'set_parse_action'

Backend

Diffusers

UI

Standard

Branch

Master

Model

StableDiffusion 1.5

Acknowledgements

  • [X] I have read the above and searched for existing issues
  • [X] I confirm that this is classified correctly and its not an extension issue

Bercraft avatar Aug 11 '24 11:08 Bercraft

Do not know how but it auto solved, maybe some incompatibility with reactor but really do not know

Bercraft avatar Aug 13 '24 16:08 Bercraft

I found the culprit on clean install works, as soon as one activates nncf, regional prompter stops working and automatic needs a clean install to work again not enough to disable nncf

Bercraft avatar Aug 14 '24 15:08 Bercraft

reinstall is almost never needed, definitely not for this. worst case, you can just reset configuration. changing description of issue to capture actual cause.

vladmandic avatar Aug 28 '24 13:08 vladmandic

cc @Disty0 - not sure why nncf would cause this?

vladmandic avatar Aug 28 '24 14:08 vladmandic

NNCF lists: pyparsing <3.0 Compel lists: pyparsing ~= 3.0 We can force a pyparsing version since both works fine with 3.1.

Disty0 avatar Aug 28 '24 14:08 Disty0

sure - i'll add pyparsing==3.1.4 to requirements.txt

vladmandic avatar Aug 28 '24 17:08 vladmandic