From the build directory, show the full list of command-line arguments:
Windows (PowerShell)
.\bin\Release\sd-cli.exe -hLinux/macOS
./bin/sd-cli -hSee sampling methods and schedulers for supported names, defaults, and custom sigma schedules.
The CLI defaults to seed 42 for repeatable runs. Pass --seed -1 to request a
random seed. Other omitted inference options use the
library defaults.
Video generation defaults to 6 requested frames before model
alignment. The conditioning cache uses the library default. Zero and false are
explicit inputs; invalid values are reported rather than treated as omitted.
IP-Adapter, PhotoMaker, PuLID, AnimateDiff, SLG, NitroFusion, ADetailer and video
upscaling use explicit DGL workflows. Their former native CLI options and the
adetailer / vid_upscale modes have been removed. See the
model and component guides for scripts.
--ref-video accepts a frame directory or a video file. Directories retain
filename order and 24 fps; files are decoded through DGL video::load at
24 fps. Supported embedded audio is retained unless a matching
--ref-video-audio file overrides it. --control-video accepts the same inputs.
Files are sampled at the generation --fps (default 16), without audio.
--video-frames limits decoding after resampling. The built-in codecs read
AVI, static or animated WebP, and independent-frame VP8 WebM. With FFmpeg,
the CLI can also read H.264 MP4 and VP9/Opus WebM, and write MP4.
See DGL media input and output
for codec and build requirements and the SD_FFMPEG_PATH override.
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.
Native image/video generation and upscaling print the translated DGL program
before execution at debug level (--log-level debug).
Run a DGL program with sd-cli -M dgl --script program.dgl.
DGL mode accepts the same logging options and sends logs to stderr.
DGL previews are off by default. Use --preview on (or true, yes, or
1) to enable them, and --preview off (or none, false, no, or 0)
to disable them. Use --preview-path, --preview-interval, and
--preview-noisy to configure the output.
The script selects the preview method. Sampling uses projection by default,
and preview(decoder = ...) uses the supplied decoder. Passing proj, tae,
or vae to --preview enables previews and prints a warning that the script
selects the method.
See Automatic DGL model downloads to fetch missing model files.
Use --dgl-arg NAME=VALUE to override a variable declared in the script's
var block for one invocation. Repeat the option for different variables.
sd-cli -M dgl --script workflow.dgl --dgl-arg seed=123 --dgl-arg 'prompt=a mountain lake' --dgl-arg 'size=[768,1024]'Strings use the text passed by the shell, so --dgl-arg prompt= sets an empty
string. Other values use DGL literal syntax and must match the default's type.
For example, use 7.0 for a floating-point value and '{width=768, height=1024}'
for a dictionary. Lists and dictionaries are replaced in full. Unknown and
duplicate variable names are errors. --check validates the script with the
same overrides used for execution.
Weight loading displays a progress bar with transfer speed; sampling displays
its step progress. Context progress callbacks remain active during loading.
--run-once on|off controls model release after last use and defaults to on.
Image and video generation release each model after its last use as well,
except for image batches (-b greater than 1), which keep models loaded across
the batch.
--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, WebP (including animated WebP), AVI, WebM, and Matroska
container metadata without loading any model. Use --image for both images and videos:
Windows (PowerShell)
.\bin\Release\sd-cli.exe -M metadata --image .\output.png
.\bin\Release\sd-cli.exe `
-M metadata `
--image .\output.jpg `
--metadata-format json
.\bin\Release\sd-cli.exe -M metadata --image .\output.webm
.\bin\Release\sd-cli.exe `
-M metadata `
--image .\output.avi `
--metadata-format json
.\bin\Release\sd-cli.exe `
-M metadata `
--image .\output.png `
--metadata-raw
.\bin\Release\sd-cli.exe `
-M metadata `
--image .\output.png `
--metadata-allLinux/macOS
./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.webm
./bin/sd-cli \
-M metadata \
--image ./output.avi \
--metadata-format json
./bin/sd-cli \
-M metadata \
--image ./output.png \
--metadata-raw
./bin/sd-cli \
-M metadata \
--image ./output.png \
--metadata-allFor completely black or white images or videos, NaNs, and the --linear-scale /
--attn-scale workaround, see Troubleshooting.
Generation outputs embed the core generation record.
Images retain the native JSON and an additional WebUI-compatible infotext.
--disable-image-metadata omits both from files.
Pass --autodl on to fetch missing files declared with a SHA-256 digest in
# model-source: comments before execution.
Existing regular files are reused, and --check stays offline. HTTPS downloads
require OpenSSL support.
Run the SD 1.5 example from the build directory. It downloads to
../models/checkpoints, so authorize ../models for downloads.
.\bin\Release\sd-cli.exe -M dgl --script ..\docs\dgl\sd\sd1-5-txt2img.dgl `
--autodl on --allow-download-dir ..\models./bin/sd-cli -M dgl --script ../docs/dgl/sd/sd1-5-txt2img.dgl \
--autodl on --allow-download-dir ../modelsDownloads can write under the working directory by default. Repeat
--allow-download-dir to authorize additional directories, including the
target of a linked model directory outside the working directory. Hugging Face
download hosts are allowed by default. Repeat --allow-download-host to
authorize exact hostnames for trusted mirrors and their redirects.
For private or gated Hugging Face models, set HF_TOKEN in the CLI process
environment to a Hugging Face access token
with read access to the repository. Use a https://huggingface.co/ download URL.
The token is sent to that HTTPS origin only.
Set --download-threads N to control concurrency. Rerun the command to resume
an interrupted download when the remote server supports byte ranges. Set
HTTPS_PROXY to an HTTP proxy URL such as http://localhost:8080, and use
NO_PROXY for direct connections. Both variables accept lowercase spellings.
Use SSL_CERT_FILE to specify a custom CA bundle.