Closed LGlassySky closed 1 year ago
Hi @LGlassySky,
At a glance, this appears to be a limitation of the clipseg library - are you passing >77 characters into the [txt2mask]
content? I can't think of a good reason to give clipseg or SAM that much text to work with. 1-2 words is plenty for the majority of usecases.
Can you confirm that you're formatting your prompt as shown below?
[txt2mask]select something[/txt2mask]The rest of your prompt here, should be able to exceed 77 tokens no problem
I will probably limit the [txt2mask]
content length in the next update, but I want to make sure I understand the issue first. Thanks.
Hi @LGlassySky,
At a glance, this appears to be a limitation of the clipseg library - are you passing >77 characters into the
[txt2mask]
content? I can't think of a good reason to give clipseg or SAM that much text to work with. 1-2 words is plenty for the majority of usecases.Can you confirm that you're formatting your prompt as shown below?
[txt2mask]select something[/txt2mask]The rest of your prompt here, should be able to exceed 77 tokens no problem
I will probably limit the
[txt2mask]
content length in the next update, but I want to make sure I understand the issue first. Thanks.
Hi @ThereforeGames,
I'm sorry I may not have made it clear last time.
But the program seems to mistakenly count the number of prompt words in the web-ui as the number of prompt words used for Clipseg mask (this number may not include the negative prompt for web-ui, because my negative prompt wrote a lot)
Actually,there are only two prompt words that I passed to the unprompted plug-in for mask drawing.
When the number of prompt words of my web-ui is small, the program can run normally, and it is only divided according to the prompt words in clipseg (so I guess it is only involved in counting)
In today's version 9.15.1, the program can run normally, the problem should have been fixed, thank you very much
Glad to hear the latest version is working better. 🙂
在我运行img2img时,出现以下错误:
2023-07-30 12:10:31,987 - Unprompted.txt2mask - INFO - Using cached clipseg model. Error running process: D:\sd-webui-aki-v4.2\extensions\unprompted\scripts\unprompted.py Traceback (most recent call last): File "D:\sd-webui-aki-v4.2\extensions\unprompted\lib_unprompted\shortcodes.py", line 144, in render return str(self.handler(self.token.keyword, self.pargs, self.kwargs, context, content)) File "D:\sd-webui-aki-v4.2\extensions\unprompted\lib_unprompted\shared.py", line 120, in handler return (self.shortcode_objects[f"{keyword}"].run_block(pargs, kwargs, context, content)) File "D:\sd-webui-aki-v4.2\extensions\unprompted/shortcodes\stable_diffusion\txt2mask.py", line 594, in run_block self.image_mask = get_mask().resize((self.init_image.width, self.init_image.height)) File "D:\sd-webui-aki-v4.2\extensions\unprompted/shortcodes\stable_diffusion\txt2mask.py", line 491, in get_mask preds = model(img.repeat(prompt_parts, 1, 1, 1).to(device=device), prompts)[0].cpu() File "D:\sd-webui-aki-v4.2\python\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl return forward_call(args, kwargs) File "D:\sd-webui-aki-v4.2\extensions\unprompted\lib_unprompted\stable_diffusion\clipseg\models\clipseg.py", line 360, in forward cond = self.get_cond_vec(conditional, bs) File "D:\sd-webui-aki-v4.2\extensions\unprompted\lib_unprompted\stable_diffusion\clipseg\models\clipseg.py", line 211, in get_cond_vec cond = self.compute_conditional(conditional) File "D:\sd-webui-aki-v4.2\extensions\unprompted\lib_unprompted\stable_diffusion\clipseg\models\clipseg.py", line 231, in compute_conditional text_tokens = clip.tokenize(conditional).to(dev) File "D:\sd-webui-aki-v4.2\python\lib\site-packages\clip\clip.py", line 234, in tokenize raise RuntimeError(f"Input {texts[i]} is too long for context length {context_length}") RuntimeError: Input beautiful girl, bedroom, naked towel, standing, wet hair,\nmasterpiece, top quality, best quality, official art, unity 8k wallpaper, highres, ultra-high res, ultra-detailed, beautiful and aesthetic, perfect detailed face, detailed eyes, highly detailed, is too long for context length 77
提示:Python 运行时抛出了一个异常。请检查疑难解答页面。
Error completing request Arguments: ('task(bugz8p6ra0vtey3)', 2, 'beautiful girl, bedroom, naked towel, standing, wet hair,\nmasterpiece, top quality, best quality, official art, unity 8k wallpaper, highres, ultra-high res, ultra-detailed, beautiful and aesthetic, perfect detailed face, detailed eyes, highly detailed, ', 'EasyNegative, ng_deepnegative_v1_75t, badhandv4, (worst quality:2), (low quality:2), (normal quality:2), lowres, watermark, monochrome, paintings, sketches, text, jpeg artifacts', [], None, None, {'image': <PIL.Image.Image image mode=RGBA size=768x960 at 0x29731B46110>, 'mask': <PIL.PngImagePlugin.PngImageFile image mode=RGBA size=768x960 at 0x29731B47400>}, None, None, None, None, 25, 16, 4, 0, 1, False, False, 1, 1, 5, 1.5, 0.35, 1517378349.0, -1.0, 0, 0, 0, False, 1, 768, 512, 0.85, 1, 1, 32, 0, '', '', '', [], False, [], '', <gradio.routes.Request object at 0x00000296A6E473D0>, 0, False, {'ad_model': 'face_yolov8n.pt', 'ad_prompt': '', 'ad_negative_prompt': '', 'ad_confidence': 0.3, 'ad_mask_min_ratio': 0, 'ad_mask_max_ratio': 1, 'ad_x_offset': 0, 'ad_y_offset': 0, 'ad_dilate_erode': 32, '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_sampler': False, 'ad_sampler': 'Euler a', 'ad_use_noise_multiplier': False, 'ad_noise_multiplier': 1, 'ad_restore_face': False, 'ad_controlnet_model': 'None', 'ad_controlnet_module': 'inpaint_global_harmonious', 'ad_controlnet_weight': 1, 'ad_controlnet_guidance_start': 0, 'ad_controlnet_guidance_end': 1, 'is_api': ()}, {'ad_model': 'hand_yolov8n.pt', 'ad_prompt': '', 'ad_negative_prompt': '', 'ad_confidence': 0.3, 'ad_mask_min_ratio': 0, 'ad_mask_max_ratio': 1, 'ad_x_offset': 0, 'ad_y_offset': 0, 'ad_dilate_erode': 32, '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_sampler': False, 'ad_sampler': 'Euler a', 'ad_use_noise_multiplier': False, 'ad_noise_multiplier': 1, 'ad_restore_face': False, 'ad_controlnet_model': 'None', 'ad_controlnet_module': 'inpaint_global_harmonious', 'ad_controlnet_weight': 1, 'ad_controlnet_guidance_start': 0, 'ad_controlnet_guidance_end': 1, 'is_api': ()}, False, 'MultiDiffusion', False, True, 1024, 1024, 96, 96, 48, 1, 'None', 2, False, 10, 1, 1, 64, False, False, False, False, False, 0.4, 0.4, 0.2, 0.2, '', '', 'Background', 0.2, -1.0, False, 0.4, 0.4, 0.2, 0.2, '', '', 'Background', 0.2, -1.0, False, 0.4, 0.4, 0.2, 0.2, '', '', 'Background', 0.2, -1.0, False, 0.4, 0.4, 0.2, 0.2, '', '', 'Background', 0.2, -1.0, False, 0.4, 0.4, 0.2, 0.2, '', '', 'Background', 0.2, -1.0, False, 0.4, 0.4, 0.2, 0.2, '', '', 'Background', 0.2, -1.0, False, 0.4, 0.4, 0.2, 0.2, '', '', 'Background', 0.2, -1.0, False, 0.4, 0.4, 0.2, 0.2, '', '', 'Background', 0.2, -1.0, False, 1536, 96, True, True, True, False, False, False, 'LoRA', 'None', 0, 0, 'LoRA', 'None', 0, 0, 'LoRA', 'None', 0, 0, 'LoRA', 'None', 0, 0, 'LoRA', 'None', 0, 0, None, 'Refresh models', <scripts.controlnet_ui.controlnet_ui_group.UiControlNetUnit object at 0x0000029731B46230>, <scripts.controlnet_ui.controlnet_ui_group.UiControlNetUnit object at 0x00000298C78194B0>, <scripts.controlnet_ui.controlnet_ui_group.UiControlNetUnit object at 0x00000298C78188E0>, <scripts.controlnet_ui.controlnet_ui_group.UiControlNetUnit object at 0x00000296A6E147C0>, None, False, '0', '0', 'D:\sd-webui-aki-v4.2\models/roop\inswapper_128.onnx', 'CodeFormer', 1, True, '', 1, 1, False, True, False, False, 0, None, [], 0, False, [], [], False, 0, 1, False, False, 0, None, [], -2, False, [], False, 0, None, None, True, -1.0, True, '
\n \n
\n', True, True, '', '', True, 50, True, 1, 0, False, 4, 0.5, 'Linear', 'None', 'CFG Scale
should be 2 or lower.Recommended settings: Sampling Steps: 80-100, Sampler: Euler a, Denoising strength: 0.8
', 128, 8, ['left', 'right', 'up', 'down'], 1, 0.05, 128, 4, 0, ['left', 'right', 'up', 'down'], False, False, 'positive', 'comma', 0, False, False, '', 'Will upscale the image by the selected scale factor; use width and height sliders to set tile size
', 64, 0, 2, 1, '', [], 0, '', [], 0, '', [], True, False, False, False, 0, None, None, False, None, None, False, None, None, False, None, None, False, 50) {} Traceback (most recent call last): File "D:\sd-webui-aki-v4.2\modules\call_queue.py", line 58, in f res = list(func(*args, kwargs)) File "D:\sd-webui-aki-v4.2\modules\call_queue.py", line 37, in f res = func(*args, *kwargs) File "D:\sd-webui-aki-v4.2\modules\img2img.py", line 232, in img2img processed = process_images(p) File "D:\sd-webui-aki-v4.2\modules\processing.py", line 677, in process_images res = process_images_inner(p) File "D:\sd-webui-aki-v4.2\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:\sd-webui-aki-v4.2\modules\processing.py", line 734, in process_images_inner p.init(p.all_prompts, p.all_seeds, p.all_subseeds) File "D:\sd-webui-aki-v4.2\modules\processing.py", line 1280, in init mask = mask.crop(crop_region) File "D:\sd-webui-aki-v4.2\python\lib\site-packages\PIL\Image.py", line 1224, in crop raise ValueError(msg) ValueError: Coordinate 'right' is less than 'left' 提示:Python 运行时抛出了一个异常。请检查疑难解答页面。