[diffusion] cli: profiling utilities support (#14185)

Co-authored-by: jianyingzhu <53300651@qq.com>
Co-authored-by: Jianying <53503712+jianyingzhu@users.noreply.github.com>
Co-authored-by: Mick <mickjagger19@icloud.com>
This commit is contained in:
AichenF
2025-12-08 00:59:45 +08:00
committed by GitHub
co-authored by jianyingzhu Jianying Mick
parent 125e17efd5
commit c8683ae305
9 changed files with 237 additions and 86 deletions
@@ -126,7 +126,8 @@ class SamplingParams:
# Profiling
profile: bool = False
num_profiled_timesteps: int = 2
num_profiled_timesteps: int = 5
profile_all_stages: bool = False
# Debugging
debug: bool = False
@@ -226,7 +227,7 @@ class SamplingParams:
if pipeline_config.task_type.is_image_gen():
# settle num_frames
logger.debug(f"Setting num_frames to 1 because this is a image-gen model")
logger.debug(f"Setting num_frames to 1 because this is an image-gen model")
self.num_frames = 1
self.data_type = DataType.IMAGE
else:
@@ -329,24 +330,35 @@ class SamplingParams:
action="store_true",
default=SamplingParams.enable_teacache,
)
# profiling
parser.add_argument(
"--profile",
action="store_true",
default=SamplingParams.profile,
help="Enable torch profiler for denoising stage",
)
parser.add_argument(
"--debug",
action="store_true",
default=SamplingParams.debug,
help="",
)
parser.add_argument(
"--num-profiled-timesteps",
type=int,
default=SamplingParams.num_profiled_timesteps,
help="Number of timesteps to profile after warmup",
)
parser.add_argument(
"--profile-all-stages",
action="store_true",
dest="profile_all_stages",
default=SamplingParams.profile_all_stages,
help="Used with --profile, profile all pipeline stages",
)
parser.add_argument(
"--debug",
action="store_true",
default=SamplingParams.debug,
help="",
)
parser.add_argument(
"--prompt",
type=str,