Debug
To run SD.Next in debug mode, start it with the --debug flag.
This has negligible overhead and is safe for daily use. It adds more detail to logs.
Example:
webui.bat --debug
webui.sh --debug
Extra Debug
Some debug output is too verbose for regular use, so it is controlled through environment variables.
Install & load
SD_INSTALL_DEBUG: report detailed information related to packages installationSD_PATH_DEBUG: report all used paths as they are parsedSD_SCRIPT_DEBUG: increase verbosity of script and extension load and executionSD_MOVE_DEBUG: trace all model moves from and to cpu/gpuSD_EXT_DEBUG: trace extensions load/install/update operationsSD_LOAD_DEBUG: report all model loading operations as they happenSD_PIP_DEBUG: report details about all pip operationsSD_CONFIG_DEBUG: report all configuration processing requestsSD_ENV_DEBUG: trace environment detection and startup behaviorSD_PLATFORM_DEBUG: trace platform/device initializationSD_TORCH_DEBUG: trace PyTorch internal initializationSD_TRANSFORMERS_DEBUG: trace Transformers internal operationsSD_QUEUE_DEBUG: debug request queue behaviorSD_METADATA_DEBUG: trace image metadata read/write operationsSD_MOVE_VERBOSE: print more verbose model move informationSD_COMPILE_DEBUG: trace model compile/optimization operationsSD_CAPTION_DEBUG: enable captioning subsystem debug logsSD_SECRETS_DEBUG: trace secrets handling operationsSD_UI_DEBUG: trace UI load/save debug operations
Override variables
These environment variables override paths and configuration files used by SD.Next.
SD_MODEL: load a specific checkpoint on startupSD_DATADIR: override the base user data directorySD_MODELSDIR: override the default models directorySD_EMBEDDINGSDIR: override the embeddings directorySD_VAEDIR: override the VAE directorySD_LORADIR: override the LoRA directorySD_EXTENSIONSDIR: override the extensions directorySD_CONFIG: use a custom configuration fileSD_SECRETS: use a custom secrets fileSD_UICONFIG: use a custom UI configuration fileSD_PATH_PARAMS: override theparams.txtfile pathSD_HFCACHEDIR: override the HuggingFace cache directory
Runtime / workflow
The following environment variables can change startup behavior, server settings, and workflow execution.
SD_FREEZE: disable editing settingsSD_MEDVRAM: enable medium VRAM modeSD_LOWVRAM: enable low VRAM modeSD_DISABLE: disable specific UI tabsSD_NO_CACHE: disable file cachingSD_KANVAS_DISABLE: disable Kanvas extension supportSD_VAE_DEFAULT: force default VAE output modeSD_PORT: override the web server portSD_SERVERNAME: override the server hostnameSD_SUBPATH: set the URL subpath for reverse proxiesSD_THEME: override the UI themeSD_LOCALE: override the UI localeSD_AUTH: set basic auth credentialsSD_AUTHFILE: set an auth credentials fileSD_MONITOR: enable memory monitoring modeSD_STATUS: enable server status check mode
Note:
SD_INSTALL_QUIETis primarily used in test environments to suppress installer output and is not a normal runtime debug flag.
Core processing
SD_DISABLE_PBAR: disable progress bar for all operationsSD_PROCESS_DEBUG: print detailed processing informationSD_DIFFUSERS_DEBUG: increase verbosity of diffusers processingSD_LDM_DEBUG: increase verbosity of LDM processingSD_CONTROL_DEBUG: report all debug information related to control moduleSD_PROMPT_DEBUG: print all prompt parsing and encoding informationSD_SAMPLER_DEBUG: report all possible sampler settings for selected samplerSD_STYLES_DEBUG: report styles processing informationSD_STEPS_DEBUG: report calculations done to scheduler stepsSD_VAE_DEBUG: report details on all VAE operationsSD_VIDEO_DEBUG: report all video processing operations as they happen
Networks
SD_EN_DEBUG: report all extra networks operations as they happenSD_LORA_DEBUG: increase verbosity of LoRA loading and executionSD_LORA_DUMP: dump LoRA key information during loadingSD_TI_DEBUG: enable textual inversion debug traces
Other
SD_SAVE_DEBUG: report all params and metadata save operations as they happenSD_PASTE_DEBUG: report all params paste and parse operations as they happenSD_HDR_DEBUG: print HDR processing informationSD_MASK_DEBUG: report detailed information on image masking operations as they happenSD_DOWNLOAD_DEBUG: report detailed information on model download operations as they happenSD_CALLBACK_DEBUG: report each step as it executes with full detailsSD_BROWSER_DEBUG: report all gallery operations as they happenSD_NAMEGEN_DEBUG: report all filename generation operations as they happenSD_PULID_DEBUG: debug logging for pulid operationsSD_PREVIEW_DEBUG: debug logging for live preview operationsSD_LLM_DEBUG: debug logging for LLM operationsSD_XYZ_DEBUG: enable XYZ script debug tracesSD_GRADING_DEBUG: enable grading processing debug logs
Example Windows:
set SD_PROCESS_DEBUG=true
webui.bat --debug
Example Linux:
export SD_PROCESS_DEBUG=true
webui.sh --debug
Additional information enabled through environment variables appears in logs at TRACE level.
Profiling
To run SD.Next in profiling mode, start it with --profile flag
This adds CPU/GPU and memory overhead, so it is not recommended for daily use.
SD.Next will collect profiling information from both Python, Torch and CUDA and print it upon completion of specific operations
Use environment variables to control profiler behavior:
SD_PROFILE_FLOPS: enable FLOPs profilingSD_PROFILE_SHAPES: record tensor shapes during profilingSD_PROFILE_STACK: enable stack tracing in the profilerSD_PROFILE_FOLDER: write profiler trace output to the given folder
Example:
webui.bat --debug --profile
webui.sh --debug --profile
Monitoring
SD.Next memory usage can be monitored using --monitor PERIOD flag in which case,
it will print detailed memory statistics for both CPU and GPU every n seconds.
Example:
webui.sh --debug --monitor
Crashes
If SD.Next crashes during its code, it will produce traceback in the console output
If traceback is not present and the process simply exits, that typically means the crash happened at the system level and app-level traceback could not be captured.
In that case, please check system logs for more information:
- Linux: kernel logs
dmesg -ku - Windows: Event Viewer -> Windows Logs -> Application/System
Tracebacks
If runtime error occurs during SD.Next processing, traceback will be printed in the console output
Level of information in the traceback can be further increased by setting env variables:
SD_TRACELINES: number of extra lines to show around the error lineSD_TRACEFRAMES: number of frames to show in the tracebackSD_TRACEWIDTH: width of the traceback outputSD_TRACEWRAP: enable word wrapping in the tracebackSD_TRACEINDENT: enable indent guides in the tracebackSD_TRACELOCALS: show local variables in the tracebackSD_TRACEDUNDER: show dunder variables in the traceback localsSD_TRACESUNDER: show single underscore variables in the traceback locals