Bing-su / adetailer

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

[Bug]: Cache file is not a supported model format. #350

Closed hulu7811 closed 1 year ago

hulu7811 commented 1 year ago

Describe the bug

If I enable the Adetailer, Adetailer keeps throw error:

Screenshots

No response

Console logs, from start to end.

To create a public link, set `share=True` in `launch()`.
Startup time: 133.2s (prepare environment: 2.9s, import torch: 3.2s, import gradio: 1.0s, setup paths: 0.6s, initialize shared: 0.2s, other imports: 0.6s, setup codeformer: 0.1s, load scripts: 123.0s, create ui: 1.1s, gradio launch: 0.3s).
Applying attention optimization: xformers... done.
Model loaded in 4.7s (load weights from disk: 0.7s, create model: 0.8s, apply weights to model: 3.0s, calculate empty prompt: 0.1s).
WARNING  Unable to automatically guess model task, assuming 'task=detect'. Explicitly define task for your model, i.e. 'task=detect', 'segment', 'classify', or 'pose'.
*** Error running postprocess_image: F:\AI draw\extensions\adetailer\scripts\!adetailer.py
    Traceback (most recent call last):
      File "F:\AI draw\modules\scripts.py", line 675, in postprocess_image
        script.postprocess_image(p, pp, *script_args)
      File "F:\AI draw\extensions\adetailer\adetailer\traceback.py", line 159, in wrapper
        raise error from None
    TypeError: 
提示:Python 运行时抛出了一个异常。请检查疑难解答页面。
    ┌─────────────────────────────────────────────────────────────────────────┐
    │                               System info                               │
    │ ┌─────────────┬───────────────────────────────────────────────────────┐ │
    │ │             │ Value                                                 │ │
    │ ├─────────────┼───────────────────────────────────────────────────────┤ │
    │ │    Platform │ Windows-10-10.0.22621-SP0                             │ │
    │ │      Python │ 3.10.8 (tags/v3.10.8:aaaf517, Oct 11 2022, 16:50:30)  │ │
    │ │             │ [MSC v.1933 64 bit (AMD64)]                           │ │
    │ │     Version │ v1.6.0                                                │ │
    │ │      Commit │ 5ef669de080814067961f28357256e8fe27544f4              │ │
    │ │ Commandline │ ['F:\\AI draw\\launch.py', '--theme', 'dark',         │ │
    │ │             │ '--xformers', '--api', '--autolaunch']                │ │
    │ │   Libraries │ {'torch': '2.0.1+cu118', 'torchvision':               │ │
    │ │             │ '0.15.2+cu118', 'ultralytics': '8.0.190',             │ │
    │ │             │ 'mediapipe': '0.10.5'}                                │ │
    │ └─────────────┴───────────────────────────────────────────────────────┘ │
    │                                 Inputs                                  │
    │ ┌─────────────────┬───────────────────────────────────────────────────┐ │
    │ │                 │ Value                                             │ │
    │ ├─────────────────┼───────────────────────────────────────────────────┤ │
    │ │          prompt │ (full body),a young woman                         │ │
    │ │ negative_prompt │ (badhandv4:1.5),ng_deepnegative_v1_75t,paintings, │ │
    │ │                 │ sketches, jpeg artifacts,(worst quality:2), (low  │ │
    │ │                 │ quality:2), (normal quality:2), lowres, normal    │ │
    │ │                 │ quality, ((monochrome)), ((grayscale)), skin      │ │
    │ │                 │ spots, acnes, mole,skin blemishes, age            │ │
    │ │                 │ spot,(duplicate:1.331),text, watermark, extra     │ │
    │ │                 │ digit,nail polish,unrealisticDream, badDream      │ │
    │ │          n_iter │ 1                                                 │ │
    │ │      batch_size │ 1                                                 │ │
    │ │           width │ 768                                               │ │
    │ │          height │ 512                                               │ │
    │ │    sampler_name │ DPM++ 2M Karras                                   │ │
    │ │       enable_hr │ True                                              │ │
    │ │     hr_upscaler │ 4x-UltraSharp                                     │ │
    │ │      checkpoint │ chilloutmix_NiPrunedFp32Fix.safetensors           │ │
    │ │             vae │ Automatic                                         │ │
    │ │            unet │ Automatic                                         │ │
    │ └─────────────────┴───────────────────────────────────────────────────┘ │
    │                 ADetailer                                               │
    │ ┌─────────────────────┬─────────────────┐                               │
    │ │                     │ Value           │                               │
    │ ├─────────────────────┼─────────────────┤                               │
    │ │             version │ 23.9.3          │                               │
    │ │            ad_model │ face_yolov8n.pt │                               │
    │ │           ad_prompt │                 │                               │
    │ │  ad_negative_prompt │                 │                               │
    │ │ ad_controlnet_model │ None            │                               │
    │ │              is_api │ False           │                               │
    │ └─────────────────────┴─────────────────┘                               │
    │ ┌───────────────── Traceback (most recent call last) ─────────────────┐ │
    │ │ F:\AI draw\extensions\adetailer\adetailer\traceback.py:139 in       │ │
    │ │ wrapper                                                             │ │
    │ │                                                                     │ │
    │ │   136 │   │   width = width - 4 if width > 4 else None              │ │
    │ │   137 │   │   console = Console(file=string, width=width)           │ │
    │ │   138 │   │   try:                                                  │ │
    │ │ > 139 │   │   │   return func(*args, **kwargs)                      │ │
    │ │   140 │   │   except Exception as e:                                │ │
    │ │   141 │   │   │   tables = [                                        │ │
    │ │   142 │   │   │   │   get_table(title, data)                        │ │
    │ │                                                                     │ │
    │ │ F:\AI draw\extensions\adetailer\scripts\!adetailer.py:656 in        │ │
    │ │ postprocess_image                                                   │ │
    │ │                                                                     │ │
    │ │   653 │   │   │   for n, args in enumerate(arg_list):               │ │
    │ │   654 │   │   │   │   if args.ad_model == "None":                   │ │
    │ │   655 │   │   │   │   │   continue                                  │ │
    │ │ > 656 │   │   │   │   is_processed |= self._postprocess_image_inner │ │
    │ │   657 │   │                                                         │ │
    │ │   658 │   │   if is_processed:                                      │ │
    │ │   659 │   │   │   self.save_image(                                  │ │
    │ │                                                                     │ │
    │ │ F:\AI draw\extensions\adetailer\scripts\!adetailer.py:579 in        │ │
    │ │ _postprocess_image_inner                                            │ │
    │ │                                                                     │ │
    │ │   576 │   │   │   kwargs["device"] = self.ultralytics_device        │ │
    │ │   577 │   │                                                         │ │
    │ │   578 │   │   with change_torch_load():                             │ │
    │ │ > 579 │   │   │   pred = predictor(ad_model, pp.image, args.ad_conf │ │
    │ │   580 │   │                                                         │ │
    │ │   581 │   │   masks = self.pred_preprocessing(pred, args)           │ │
    │ │   582                                                               │ │
    │ │                                                                     │ │
    │ │ F:\AI draw\extensions\adetailer\adetailer\ultralytics.py:22 in      │ │
    │ │ ultralytics_predict                                                 │ │
    │ │                                                                     │ │
    │ │   19 │   from ultralytics import YOLO                               │ │
    │ │   20 │                                                              │ │
    │ │   21 │   model = YOLO(model_path)                                   │ │
    │ │ > 22 │   pred = model(image, conf=confidence, device=device)        │ │
    │ │   23 │                                                              │ │
    │ │   24 │   bboxes = pred[0].boxes.xyxy.cpu().numpy()                  │ │
    │ │   25 │   if bboxes.size == 0:                                       │ │
    │ │                                                                     │ │
    │ │ F:\AI draw\py310\lib\site-packages\ultralytics\engine\model.py:95   │ │
    │ │ in __call__                                                         │ │
    │ │                                                                     │ │
    │ │    92 │                                                             │ │
    │ │    93 │   def __call__(self, source=None, stream=False, **kwargs):  │ │
    │ │    94 │   │   """Calls the 'predict' function with given arguments  │ │
    │ │ >  95 │   │   return self.predict(source, stream, **kwargs)         │ │
    │ │    96 │                                                             │ │
    │ │    97 │   @staticmethod                                             │ │
    │ │    98 │   def is_hub_model(model):                                  │ │
    │ │                                                                     │ │
    │ │ F:\AI draw\py310\lib\site-packages\ultralytics\engine\model.py:228  │ │
    │ │ in predict                                                          │ │
    │ │                                                                     │ │
    │ │   225 │   │                                                         │ │
    │ │   226 │   │   if not self.predictor:                                │ │
    │ │   227 │   │   │   self.predictor = (predictor or self._smart_load(' │ │
    │ │ > 228 │   │   │   self.predictor.setup_model(model=self.model, verb │ │
    │ │   229 │   │   else:  # only update args if predictor is already set │ │
    │ │   230 │   │   │   self.predictor.args = get_cfg(self.predictor.args │ │
    │ │   231 │   │   │   if 'project' in args or 'name' in args:           │ │
    │ │                                                                     │ │
    │ │ F:\AI                                                               │ │
    │ │ draw\py310\lib\site-packages\ultralytics\engine\predictor.py:305 in │ │
    │ │ setup_model                                                         │ │
    │ │                                                                     │ │
    │ │   302 │                                                             │ │
    │ │   303 │   def setup_model(self, model, verbose=True):               │ │
    │ │   304 │   │   """Initialize YOLO model with given parameters and se │ │
    │ │ > 305 │   │   self.model = AutoBackend(model or self.args.model,    │ │
    │ │   306 │   │   │   │   │   │   │   │    device=select_device(self.ar │ │
    │ │   307 │   │   │   │   │   │   │   │    dnn=self.args.dnn,           │ │
    │ │   308 │   │   │   │   │   │   │   │    data=self.args.data,         │ │
    │ │                                                                     │ │
    │ │ F:\AI draw\py310\lib\site-packages\torch\utils\_contextlib.py:115   │ │
    │ │ in decorate_context                                                 │ │
    │ │                                                                     │ │
    │ │   112 │   @functools.wraps(func)                                    │ │
    │ │   113 │   def decorate_context(*args, **kwargs):                    │ │
    │ │   114 │   │   with ctx_factory():                                   │ │
    │ │ > 115 │   │   │   return func(*args, **kwargs)                      │ │
    │ │   116 │                                                             │ │
    │ │   117 │   return decorate_context                                   │ │
    │ │   118                                                               │ │
    │ │                                                                     │ │
    │ │ F:\AI                                                               │ │
    │ │ draw\py310\lib\site-packages\ultralytics\nn\autobackend.py:286 in   │ │
    │ │ __init__                                                            │ │
    │ │                                                                     │ │
    │ │   283 │   │   │   raise NotImplementedError('Triton Inference Serve │ │
    │ │   284 │   │   else:                                                 │ │
    │ │   285 │   │   │   from ultralytics.engine.exporter import export_fo │ │
    │ │ > 286 │   │   │   raise TypeError(f"model='{w}' is not a supported  │ │
    │ │   287 │   │   │   │   │   │   │   'See https://docs.ultralytics.com │ │
    │ │   288 │   │   │   │   │   │   │   f'\n\n{export_formats()}')        │ │
    │ │   289                                                               │ │
    │ └─────────────────────────────────────────────────────────────────────┘ │
    │ TypeError: model='F:\AI                                                 │
    │ draw\.cache\sdwebuilauncher\hfmirror\blob\30e7adcf03c1e250ffce66a9ff532 │
    │ 4358c311f02a093f93f5424d650803ce077' is not a supported model format.   │
    │ See https://docs.ultralytics.com/modes/predict for help.                │
    │                                                                         │
    │                    Format     Argument           Suffix    CPU    GPU   │
    │ 0                 PyTorch            -              .pt   True   True   │
    │ 1             TorchScript  torchscript     .torchscript   True   True   │
    │ 2                    ONNX         onnx            .onnx   True   True   │
    │ 3                OpenVINO     openvino  _openvino_model   True  False   │
    │ 4                TensorRT       engine          .engine  False   True   │
    │ 5                  CoreML       coreml       .mlpackage   True  False   │
    │ 6   TensorFlow SavedModel  saved_model     _saved_model   True   True   │
    │ 7     TensorFlow GraphDef           pb              .pb   True   True   │
    │ 8         TensorFlow Lite       tflite          .tflite   True  False   │
    │ 9     TensorFlow Edge TPU      edgetpu  _edgetpu.tflite   True  False   │
    │ 10          TensorFlow.js         tfjs       _web_model   True  False   │
    │ 11           PaddlePaddle       paddle    _paddle_model   True   True   │
    │ 12                   ncnn         ncnn      _ncnn_model   True   True   │
    └─────────────────────────────────────────────────────────────────────────┘

List of installed extensions

No response

hulu7811 commented 1 year ago

Sorry, after I delete the all the files in .cache folder, and reboot the webui. everything is working. Issue closed