Profiling
SD.Next has built-in support for both Python and Torch profiling
Profiling can be started for the entire session using --profile
command line flag
Or it can be started/stopped on-demand using UI -> System -> Start/Stop profiling
When profiling is enabled, analysis is performed
- As a last step of server startup to see performance and bottlenecks of the startup process
- As the last step of any generate workflow
Warning
Collecting profile information may take significant resources and time
Saving
Full torch
profiling dump can be saved for analysis using external tools by setting env variable to location where to save profiling info:
SD_PROFILE_FOLDER=/tmp/profile
Each profiling run will create a JSON file in the specified folder
File can be loaded for further analysis in tools such as:
-
Warning
Each profile trace file is over 100MB in size
Advanced
Profiling details can be further increased by setting additional environment variables:
SD_PROFILE_STACK=true
: enable torch stack informationSD_PROFILE_FLOPS=true
: enable torch flops calculationsSD_PROFILE_SHAPES=true
: group torch profile information per each shape