stable-diffusion.cpp/examples/cli
leejet 1d0a58a350
Some checks failed
CI / ubuntu-latest-cmake (push) Has been cancelled
CI / ubuntu-latest-cmake-vulkan (push) Has been cancelled
CI / Build and push container images (push) Has been cancelled
CI / macOS-latest-cmake (push) Has been cancelled
CI / windows-latest-cmake (cpu, -DGGML_NATIVE=OFF -DSD_BUILD_SHARED_LIBS=ON -DSD_BUILD_SHARED_GGML_LIB=ON -DGGML_BACKEND_DL=ON -DGGML_CPU_ALL_VARIANTS=ON) (push) Has been cancelled
CI / windows-latest-cmake (cuda12, -DSD_CUDA=ON -DSD_BUILD_SHARED_LIBS=ON -DCMAKE_CUDA_ARCHITECTURES='61;70;75;80;86;89;90;100;120' -DCMAKE_CUDA_FLAGS='-Xcudafe "--diag_suppress=177" -Xcudafe "--diag_suppress=550"' -DGGML_NATIVE=OFF -DSD_BUILD_SHARED_GGML_L… (push) Has been cancelled
CI / windows-latest-cmake (vulkan, -DSD_VULKAN=ON -DSD_BUILD_SHARED_LIBS=ON -DGGML_NATIVE=OFF -DSD_BUILD_SHARED_GGML_LIB=ON -DGGML_BACKEND_DL=ON -DGGML_CPU_ALL_VARIANTS=ON) (push) Has been cancelled
CI / windows-latest-rocm (push) Has been cancelled
CI / ubuntu-latest-rocm (10.1.0, x64, gfx900;gfx906;gfx908;gfx90a;gfx90c;gfx942;gfx950;gfx1010;gfx1011;gfx1012;gfx1030;gfx1031;gfx1032;gfx1033;gfx1034;gfx1035;gfx1036;gfx1100;gfx1101;gfx1102;gfx1103;gfx1150;gfx1151;gfx1152;gfx1153;gfx1200;gfx1201) (push) Has been cancelled
CI / release (push) Has been cancelled
chore: move parameter and tokenizer diagnostics to debug (#2135)
2026-10-13 23:37:58 +08:00
..
CMakeLists.txt fix: add zip library back to cli target link libraries (#1719) 2026-06-29 21:42:02 +08:00
image_metadata.cpp feat: add webp support (#1384) 2026-04-02 01:36:11 +08:00
image_metadata.h feat(cli): add metadata inspection mode (#1381) 2026-04-01 00:52:03 +08:00
main.cpp chore: move parameter and tokenizer diagnostics to debug (#2135) 2026-10-13 23:37:58 +08:00
README.md feat: add automatic direct convolution selection (#2134) 2026-10-13 23:25:19 +08:00

Usage

For detailed command-line arguments, run:

./bin/sd-cli -h

Logging defaults to info. Use --log-level <level> to select debug, verbose, info, warn, or error (from most to least detailed). Each level includes messages at that level and all less detailed levels. -v and --verbose are equivalent to --log-level verbose. If repeated, the last logging option wins.

--flash-attn on|off|auto defaults to auto, selecting flash attention for each compute backend during context creation. See Backend selection for probing behavior. Use module assignments such as --flash-attn auto,te=off,vae=on to override individual modules.

--conv-direct on|off|auto also defaults to auto, enabling direct convolution on backends with implicit GEMM implementations. Use --conv-direct auto,vae=off for module overrides; supported modules are diffusion, vae, and controlnet. See Direct convolution.

For direct image repair or automatic post-generation YOLOv8 detection followed by cropped inpainting, see ADetailer.

Use repeatable --image-preprocess rules to select resizing, cropping, padding, and resampling separately for each image input. Add canny=true to any input rule for edge detection. See Image preprocessing for input selectors, input defaults, downstream model processing, mask alignment, and examples.

Metadata mode inspects PNG/JPEG container metadata without loading any model:

./bin/sd-cli -M metadata --image ./output.png
./bin/sd-cli -M metadata --image ./output.jpg --metadata-format json
./bin/sd-cli -M metadata --image ./output.png --metadata-raw
./bin/sd-cli -M metadata --image ./output.png --metadata-all

For completely black or white images or videos, NaNs, and the --linear-scale / --attn-scale workaround, see Troubleshooting.