Bing-su / adetailer

Auto detecting, masking and inpainting with detection model.
GNU Affero General Public License v3.0
4.1k stars 318 forks source link

[Bug]: in wrapper raise error from None #712

Open Road-Car opened 2 weeks ago

Road-Car commented 2 weeks ago

Describe the bug

使用adetailer时候,出现 File "D:\sd-webui-aki-v4.8\extensions\adetailer\aaaaaa\traceback.py", line 173, in wrapper raise error from None

Steps to reproduce

No response

Screenshots

No response

Console logs, from start to end.

*** Error running postprocess_image: D:\sd-webui-aki-v4.8\extensions\adetailer\scripts\!adetailer.py
    Traceback (most recent call last):
      File "D:\sd-webui-aki-v4.8\modules\scripts.py", line 912, in postprocess_image
        script.postprocess_image(p, pp, *script_args)
      File "D:\sd-webui-aki-v4.8\extensions\adetailer\aaaaaa\traceback.py", line 173, in wrapper
        raise error from None
    ValueError:
    ┌─────────────────────────────────────────────────────────────────────────┐
    │                               System info                               │
    │ ┌─────────────┬───────────────────────────────────────────────────────┐ │
    │ │             │ Value                                                 │ │
    │ ├─────────────┼───────────────────────────────────────────────────────┤ │
    │ │    Platform │ Windows-10-10.0.19041-SP0                             │ │
    │ │      Python │ 3.10.11 (tags/v3.10.11:7d4cc5a, Apr  5 2023,          │ │
    │ │             │ 00:38:17) [MSC v.1929 64 bit (AMD64)]                 │ │
    │ │     Version │ v1.10.1                                               │ │
    │ │      Commit │ 82a973c04367123ae98bd9abdf80d9eda9b910e2              │ │
    │ │ Commandline │ ['D:\\sd-webui-aki-v4.8\\launch.py', '--theme',       │ │
    │ │             │ 'dark', '--upcast-sampling', '--api', '--autolaunch', │ │
    │ │             │ '--skip-python-version-check']                        │ │
    │ │   Libraries │ {'torch': '2.2.2+cu118', 'torchvision':               │ │
    │ │             │ '0.17.2+cu118', 'ultralytics': '8.2.92', 'mediapipe': │ │
    │ │             │ None}                                                 │ │
    │ └─────────────┴───────────────────────────────────────────────────────┘ │
    │                              Inputs                                     │
    │ ┌─────────────────┬─────────────────────────────────────────────┐       │
    │ │                 │ Value                                       │       │
    │ ├─────────────────┼─────────────────────────────────────────────┤       │
    │ │          prompt │ 1girl,half-body photo,                      │       │
    │ │ negative_prompt │                                             │       │
    │ │          n_iter │ 1                                           │       │
    │ │      batch_size │ 1                                           │       │
    │ │           width │ 512                                         │       │
    │ │          height │ 768                                         │       │
    │ │    sampler_name │ DPM++ 2M                                    │       │
    │ │       enable_hr │ False                                       │       │
    │ │     hr_upscaler │ Latent                                      │       │
    │ │      checkpoint │ 2.5D\dreamshaper_8.safetensors [879db523c3] │       │
    │ │             vae │ None                                        │       │
    │ │            unet │ Automatic                                   │       │
    │ └─────────────────┴─────────────────────────────────────────────┘       │
    │                 ADetailer                                               │
    │ ┌─────────────────────┬─────────────────┐                               │
    │ │                     │ Value           │                               │
    │ ├─────────────────────┼─────────────────┤                               │
    │ │             version │ 24.9.0          │                               │
    │ │            ad_model │ face_yolov8s.pt │                               │
    │ │           ad_prompt │                 │                               │
    │ │  ad_negative_prompt │                 │                               │
    │ │ ad_controlnet_model │ None            │                               │
    │ │              is_api │ False           │                               │
    │ └─────────────────────┴─────────────────┘                               │
    │ ┌───────────────── Traceback (most recent call last) ─────────────────┐ │
    │ │ D:\sd-webui-aki-v4.8\extensions\adetailer\aaaaaa\traceback.py:153   │ │
    │ │ in wrapper                                                          │ │
    │ │                                                                     │ │
    │ │   152 │   │   try:                                                  │ │
    │ │ > 153 │   │   │   return func(*args, **kwargs)                      │ │
    │ │   154 │   │   except Exception as e:                                │ │
    │ │                                                                     │ │
    │ │ D:\sd-webui-aki-v4.8\extensions\adetailer\scripts\!adetailer.py:909 │ │
    │ │ in postprocess_image                                                │ │
    │ │                                                                     │ │
    │ │    908 │   │   │   │   │   continue                                 │ │
    │ │ >  909 │   │   │   │   is_processed |= self._postprocess_image_inne │ │
    │ │    910                                                              │ │
    │ │                                                                     │ │
    │ │ D:\sd-webui-aki-v4.8\extensions\adetailer\scripts\!adetailer.py:823 │ │
    │ │ in _postprocess_image_inner                                         │ │
    │ │                                                                     │ │
    │ │    822 │   │   │   │   ad_model = self.get_ad_model(args.ad_model)  │ │
    │ │ >  823 │   │   │   │   pred = ultralytics_predict(                  │ │
    │ │    824 │   │   │   │   │   ad_model,                                │ │
    │ │                                                                     │ │
    │ │ D:\sd-webui-aki-v4.8\extensions\adetailer\adetailer\ultralytics.py: │ │
    │ │ 25 in ultralytics_predict                                           │ │
    │ │                                                                     │ │
    │ │   24 ) -> PredictOutput[float]:                                     │ │
    │ │ > 25 │   from ultralytics import YOLO                               │ │
    │ │   26                                                                │ │
    │ │                                                                     │ │
    │ │ D:\sd-webui-aki-v4.8\python\lib\site-packages\ultralytics\__init__. │ │
    │ │ py:11 in <module>                                                   │ │
    │ │                                                                     │ │
    │ │   10                                                                │ │
    │ │ > 11 from ultralytics.data.explorer.explorer import Explorer        │ │
    │ │   12 from ultralytics.models import NAS, RTDETR, SAM, YOLO, FastSAM │ │
    │ │                                                                     │ │
    │ │ D:\sd-webui-aki-v4.8\python\lib\site-packages\ultralytics\data\__in │ │
    │ │ it__.py:3 in <module>                                               │ │
    │ │                                                                     │ │
    │ │    2                                                                │ │
    │ │ >  3 from .base import BaseDataset                                  │ │
    │ │    4 from .build import build_dataloader, build_grounding, build_yo │ │
    │ │                                                                     │ │
    │ │ D:\sd-webui-aki-v4.8\python\lib\site-packages\ultralytics\data\base │ │
    │ │ .py:17 in <module>                                                  │ │
    │ │                                                                     │ │
    │ │    16                                                               │ │
    │ │ >  17 from ultralytics.data.utils import FORMATS_HELP_MSG, HELP_URL │ │
    │ │    18 from ultralytics.utils import DEFAULT_CFG, LOCAL_RANK, LOGGER │ │
    │ │                                                                     │ │
    │ │ D:\sd-webui-aki-v4.8\python\lib\site-packages\ultralytics\data\util │ │
    │ │ s.py:19 in <module>                                                 │ │
    │ │                                                                     │ │
    │ │    18                                                               │ │
    │ │ >  19 from ultralytics.nn.autobackend import check_class_names      │ │
    │ │    20 from ultralytics.utils import (                               │ │
    │ │                                                                     │ │
    │ │ D:\sd-webui-aki-v4.8\python\lib\site-packages\ultralytics\nn\__init │ │
    │ │ __.py:3 in <module>                                                 │ │
    │ │                                                                     │ │
    │ │    2                                                                │ │
    │ │ >  3 from .tasks import (                                           │ │
    │ │    4 │   BaseModel,                                                 │ │
    │ │                                                                     │ │
    │ │ D:\sd-webui-aki-v4.8\python\lib\site-packages\ultralytics\nn\tasks. │ │
    │ │ py:10 in <module>                                                   │ │
    │ │                                                                     │ │
    │ │      9                                                              │ │
    │ │ >   10 from ultralytics.nn.modules import (                         │ │
    │ │     11 │   AIFI,                                                    │ │
    │ │                                                                     │ │
    │ │ D:\sd-webui-aki-v4.8\python\lib\site-packages\ultralytics\nn\module │ │
    │ │ s\__init__.py:20 in <module>                                        │ │
    │ │                                                                     │ │
    │ │    19                                                               │ │
    │ │ >  20 from .block import (                                          │ │
    │ │    21 │   C1,                                                       │ │
    │ │                                                                     │ │
    │ │ D:\sd-webui-aki-v4.8\python\lib\site-packages\ultralytics\nn\module │ │
    │ │ s\block.py:8 in <module>                                            │ │
    │ │                                                                     │ │
    │ │     7                                                               │ │
    │ │ >   8 from ultralytics.utils.torch_utils import fuse_conv_and_bn    │ │
    │ │     9                                                               │ │
    │ │                                                                     │ │
    │ │ D:\sd-webui-aki-v4.8\python\lib\site-packages\ultralytics\utils\__i │ │
    │ │ nit__.py:1173 in <module>                                           │ │
    │ │                                                                     │ │
    │ │   1172 PREFIX = colorstr("Ultralytics: ")                           │ │
    │ │ > 1173 SETTINGS = SettingsManager()  # initialize settings          │ │
    │ │   1174 DATASETS_DIR = Path(SETTINGS["datasets_dir"])  # global data │ │
    │ │                                                                     │ │
    │ │ D:\sd-webui-aki-v4.8\python\lib\site-packages\ultralytics\utils\__i │ │
    │ │ nit__.py:1056 in __init__                                           │ │
    │ │                                                                     │ │
    │ │   1055 │   │   from ultralytics.utils.checks import check_version   │ │
    │ │ > 1056 │   │   from ultralytics.utils.torch_utils import torch_dist │ │
    │ │   1057                                                              │ │
    │ │                                                                     │ │
    │ │ D:\sd-webui-aki-v4.8\python\lib\site-packages\ultralytics\utils\tor │ │
    │ │ ch_utils.py:35 in <module>                                          │ │
    │ │                                                                     │ │
    │ │    34 try:                                                          │ │
    │ │ >  35 │   import thop                                               │ │
    │ │    36 except ImportError:                                           │ │
    │ │                                                                     │ │
    │ │ D:\sd-webui-aki-v4.8\python\lib\site-packages\thop\__init__.py:5 in │ │
    │ │ <module>                                                            │ │
    │ │                                                                     │ │
    │ │   4                                                                 │ │
    │ │ > 5 from .profile import profile, profile_origin                    │ │
    │ │   6 from .utils import clever_format                                │ │
    │ └─────────────────────────────────────────────────────────────────────┘ │
    │ ValueError: source code string cannot contain null bytes                │
    └─────────────────────────────────────────────────────────────────────────┘

List of installed extensions

No response

dosubot[bot] commented 2 weeks ago

@Road-Car Hello there! I'm here to help you with any bugs, questions, or contributions you might have. Let's squash those bugs together! 🤖

I found a similar closed issue, [Bug]: Error when using ADetailer API, which was last updated on October 22, 2023. The suggested solution is to review the input payload and remove any fields that are not recognized by the ADetailerArgs model [1].

The wrapper function in traceback.py is designed to provide enhanced error handling and reporting. It captures any exceptions raised by the wrapped function, gathers system information, input data, and specific details related to the ADetailer module, and formats this information into a detailed, readable traceback using the rich library. The function is designed to handle any kind of exception that might be raised during the execution of the wrapped function [2].

The error message "source code string cannot contain null bytes" typically occurs when Python encounters a null byte (\x00) in a string that is being interpreted as source code. This can happen due to various reasons, such as corrupted files or incorrect handling of binary data. In the context of this project, it might be related to the ultralytics library or the way files are being read or imported.

To resolve this issue, you can try the following steps:

  1. Check for Corrupted Files: Ensure that none of the files in your project, especially those related to ultralytics, are corrupted. You can try re-downloading or re-installing the affected libraries.
  2. Inspect File Reading Operations: If your code reads files, ensure that it correctly handles binary and text data. Avoid mixing binary and text modes when opening files.
  3. Update Dependencies: Ensure that all dependencies, including ultralytics, are up-to-date. Sometimes, bugs are fixed in newer versions of libraries.

If the issue persists, you might need to provide more details about the specific context in which the error occurs, such as the exact code or operations being performed when the error is raised.

To continue talking to Dosu, mention @dosu.

Bing-su commented 1 week ago

Try reinstalling venv.