Skip to content
Vladimir Mandic edited this page Jan 31, 2025 · 13 revisions

Debug

To run SD.Next in debug mode, start it with --debug flag
This has no overhead and can be safely used in daily operations as it just prints additional information to logs

Example:

webui.bat --debug
webui.sh --debug

Extra Debug

Some debug information would be too much for regular use, so it can be enabled by use of environment variables:

Install & load

  • SD_INSTALL_DEBUG: report detailed information related to packages installation
  • SD_PATH_DEBUG: report all used paths as they are parsed
  • SD_SCRIPT_DEBUG: increase verbosity of script and extension load and execution
  • SD_MOVE_DEBUG: trace all model moves from and to cpu/gpu
  • SD_EXT_DEBUG: trace extensions load/install/update operations
  • SD_LOAD_DEBUG: report all model loading operations as they happen
  • SD_PIP_DEBUG: report details about all pip operations
  • SD_CONFIG_DEBUG: report all configuration processing requests

Core processing

  • SD_DISABLE_PBAR: disable progress bar for all operations
  • SD_PROCESS_DEBUG: print detailed processing information
  • SD_DIFFUSERS_DEBUG: increase verbosity of diffusers processing
  • SD_LDM_DEBUG: increase verbosity of LDM processing
  • SD_CONTROL_DEBUG: report all debug information related to control module
  • SD_PROMPT_DEBUG: print all prompt parsing and encoding information
  • SD_SAMPLER_DEBUG: report all possible sampler settings for selected sampler
  • SD_STEPS_DEBUG: report calculations done to scheduler steps
  • SD_VAE_DEBUG: report details on all VAE operations

Networks

  • SD_EN_DEBUG: report all extra networks operations as they happen
  • SD_LORA_DEBUG: increase verbosity of LoRA loading and execution

Other

  • SD_PASTE_DEBUG: report all params paste and parse operations as they happen
  • SD_HDR_DEBUG: print HDR processing information
  • SD_MASK_DEBUG: reported detailed information on image masking operations as they happen
  • SD_DOWNLOAD_DEBUG: report detailed information on model download operations as they happen
  • SD_CALLBACK_DEBUG: report each step as it executes with full details
  • SD_BROWSER_DEBUG: report all gallery operations as they happen
  • SD_NAMEGEN_DEBUG: report all filename generation operations as they happen
  • SD_PULID_DEBUG: debug logging for pulid operations
  • SD_PREVIEW_DEBUG: debug logging for live preview operations

Example Windows:

set SD_PROCESS_DEBUG=true
webui.bat --debug

Example Linux:

export SD_PROCESS_DEBUG=true
webui.sh --debug

Additional information enabled via env variables will show in log with level TRACE

Profiling

To run SD.Next in profiling mode, start it with --profile flag
This does have overhead, both on processing and memory side, so its 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

Example:

webui.bat --debug --profile
webui.sh --debug --profile

Crashes

If SD.Next crashes during its code, it will produce traceback in the console output
If traceback is not present and process simply exited that typically means that process crashed on the system side and app-level traceback cannot 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 line
  • SD_TRACEFRAMES: number of frames to show in the traceback
  • SD_TRACEWIDTH: width of the traceback output
  • SD_TRACEWRAP: enable word wrapping in the traceback
  • SD_TRACEINDENT: enable indent guides in the traceback
  • SD_TRACELOCALS: show local variables in the traceback
  • SD_TRACEDUNDER: show dunder variables in the traceback locals
  • SD_TRACESUNDER: show single underscore variables in the traceback locals
Clone this wiki locally