dmx.compressor.utils.benchmark.measure_mode_perf

dmx.compressor.utils.benchmark.measure_mode_perf(model: Module, model_runner: Callable[[Module | DmxModel], None], device: device, evaluation_mode: EVALUATION_MODE, n_warmup_runs: int = 1, n_measure_runs: int = 5)

Measure model’s runtime statistics for a given mode

Parameters:
  • model (torch.nn.Module) – Pytorch model to measure

  • model_runner (Callable[[Union[torch.nn.Module, DmxModel]], None]) – Callable to run a sample input through the model

  • device (torch.device) – device on which to run the model

  • evaluation_mode (EVALUATION_MODE) – Model mode (Vanilla torch, Baseline, Basic without VSIMD ops, Basic)

  • n_warmup_runs (int) – Number of warmup runs before gathering statistics

  • n_measure_runs (int) – Number of runs across which to average the gathered statistics