ProfilerHook — mmengine 0.10.7 documentation (original) (raw)

class mmengine.hooks.ProfilerHook(*, by_epoch=True, profile_times=1, activity_with_cpu=True, activity_with_cuda=False, schedule=None, on_trace_ready=None, record_shapes=False, profile_memory=False, with_stack=False, with_flops=False, json_trace_path=None)[source]

A hook to analyze performance during training and inference.

PyTorch Profiler is a tool that allows the collection of the performance metrics during the training. More details on Profiler can be found atofficial docs

Parameters:

Warning

The profiler will be closed after profile_times iterations automatically. Please make sure the configuration of your scheduler will not close the profiler before the iteration reach the value ofprofile_times

Examples

tensorboard trace

trace_config = dict(type='tb_trace') profiler_hook_cfg = dict(on_trace_ready=trace_config)

after_train_epoch(runner)[source]

Determine if the content is exported.

after_train_iter(runner, batch_idx, data_batch, outputs)[source]

Profiler will call step method if it is not closed.

before_run(runner)[source]

Initialize the profiler.

Through the runner parameter, the validity of the parameter is further determined.