Skip to content

[Bug] ADetailer Conversion Detector Error #1827

Description

@drone540

Git commit

stable-diffusion.cpp master-797-5ef4a75

Operating System & Version

Kubuntu 24.04

GGML backends

Vulkan

Command-line arguments used

sd-cli -M adetailer -m /DATA/AppData/llama-swap-unified/models/stablediffusion/sd15/DreamShaper_8_pruned.safetensors -i generated-image-1785243512971-0.png -o repaired.png -p "close-up portrait of wonder woman, face visible" --ad-model /DATA/AppData/llama-swap-unified/models/stablediffusion/adetailer/face_yolov8n.safetensors --extra-ad-args "confidence=0.3"

Steps to reproduce

I have tried and seemingly failed to use the script to convert the adetailer face_yolov8n.pt to a safetensors that works with the following docker script that I used for conversion:

docker run --rm -it \
  -v "$PWD:/work" \
  -w /work \
  python:3.12 \
  bash -c "
    [ -f face_yolov8n.pt ] || wget https://huggingface.co/Bingsu/adetailer/resolve/main/face_yolov8n.pt &&
    [ -f convert_yolov8_to_safetensors.py ] || wget https://raw.githubusercontent.com/leejet/stable-diffusion.cpp/refs/heads/master/scripts/convert_yolov8_to_safetensors.py &&
    [ -f face_yolov8n.safetensors ] || (
      pip install --no-cache-dir torch torchvision --index-url https://download.pytorch.org/whl/cpu &&
      pip install --no-cache-dir ultralytics safetensors &&
      pip uninstall -y opencv-python &&
      pip install --no-cache-dir opencv-python-headless &&
      python convert_yolov8_to_safetensors.py face_yolov8n.pt face_yolov8n.safetensors
    )
  "

What you expected to happen

The conversion to work properly and sd-server and sd-cli used adetailer

What actually happened

It claims to have converted it:

WARNING ⚠️ user config directory '/root/.config/Ultralytics' is not writeable, using '/tmp/Ultralytics'. Set YOLO_CONFIG_DIR to override.
Creating new Ultralytics Settings v0.0.6 file ✅
View Ultralytics Settings with 'yolo settings' or at '/tmp/Ultralytics/settings.json'
Update Settings with 'yolo settings key=value', i.e. 'yolo settings runs_dir=path/to/dir'. For help see https://docs.ultralytics.com/quickstart/#ultralytics-settings.
YOLOv8n summary (fused): 72 layers, 3,005,843 parameters, 0 gradients, 8.1 GFLOPs
wrote face_yolov8n.safetensors: 126 tensors

Logs / error messages / stack trace

ggml_vulkan: Found 1 Vulkan devices:
ggml_vulkan: 0 = Quadro T1000 with Max-Q Design (NVIDIA) | uma: 0 | fp16: 1 | bf16: 0 | warp size: 32 | shared memory: 49152 | int dot: 0 | matrix cores: none
load_backend: loaded Vulkan backend from /opt/ai/stable-diffusion.cpp/libggml-vulkan.so
load_backend: loaded CPU backend from /opt/ai/stable-diffusion.cpp/libggml-cpu-haswell.so
[INFO ] common.cpp:2158 - set width x height to 512 x 512
[INFO ] stable-diffusion.cpp:717  - loading model from '/DATA/AppData/llama-swap-unified/models/stablediffusion/sd15/DreamShaper_8_pruned.safetensors'
[INFO ] model_loader.cpp:242  - load /DATA/AppData/llama-swap-unified/models/stablediffusion/sd15/DreamShaper_8_pruned.safetensors using safetensors format
[INFO ] stable-diffusion.cpp:868  - Version: SD 1.x
[INFO ] stable-diffusion.cpp:923  - Weight type stat:                      f16: 1130
[INFO ] stable-diffusion.cpp:924  - Conditioner weight type stat:          f16: 196
[INFO ] stable-diffusion.cpp:925  - Diffusion model weight type stat:      f16: 686
[INFO ] stable-diffusion.cpp:926  - VAE weight type stat:                  f16: 248
[INFO ] stable-diffusion.cpp:1442 - using VAE for encoding / decoding
[INFO ] auto_encoder_kl.hpp:527  - vae decoder: ch = 128
[INFO ] stable-diffusion.cpp:1666 - total params memory size = 2035.00MB (VRAM 2035.00MB, RAM 0.00MB): text_encoders 235.06MB(VRAM), diffusion_model 1640.25MB(VRAM), vae 159.68MB(VRAM), controlnet 0.00MB(N/A), extensions 0.00MB(N/A)
[INFO ] stable-diffusion.cpp:1767 - running in eps-prediction mode
[WARN ] model_loader.cpp:252  - unknown format /DATA/AppData/llama-swap-unified/models/stablediffusion/adetailer/face_yolov8n.safetensors
[ERROR] detailer.cpp:681  - failed to load ADetailer detector: '/DATA/AppData/llama-swap-unified/models/stablediffusion/adetailer/face_yolov8n.safetensors'
[ERROR] main.cpp:591  - new_adetailer_ctx failed

Additional context / environment details

I have also tried with ultralytics==8.3.216 which is supposedly the last version before something changed that originally broke it.

I am not sure how to get this to actually work.

Also it seems that only sd-cli seems to call the adetailer? I did not see any errors reported when I was trying to get it to work with llama-swap from sd-server. It just generated the image and claimed adetailer was used in the pnginfo even though it never ran.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions