# progress_handler

Python API: `modelconverter.utils.progress_handler`

Progress reporting for the on-device benchmarking loops.

A benchmark runs either for a fixed duration or for a fixed number of repetitions. This module builds the progress bar for
whichever mode is selected, along with the loop guard and the per-iteration update the benchmark backends drive it with.

## Functions

| Name | Description |
| --- | --- |
| [`create_progress_handler`](https://docs.luxonis.com/software-v3/ai-inference/conversion/rvc-conversion/offline/modelconverter/modelconverter-api-reference/utils/progress_handler.md#progress_handler-Functions-create_progress_handler) | Create a progress bar for time- or repetition-based benchmarks. |

### function `create_progress_handler`

```python
def create_progress_handler(
    benchmark_time: int,
    repetitions: int,
) -> tuple[Progress, Callable[[], None], Callable[[], bool]]
```

Create a progress bar for time- or repetition-based benchmarks.

Args

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `benchmark_time` | `int` | Duration in seconds to benchmark for. A positive value selects the time-based mode. | required |
| `repetitions` | `int` | Number of repetitions to benchmark for. Used when `benchmark_time` is not positive. | required |

Returns

| Type | Description |
| --- | --- |
| `tuple[Progress, Callable[[], None], Callable[[], bool]]` | A tuple of the Rich `Progress` instance (context-manage it with `with progress:`), an `on_tick()` callable to be called once per iteration to update the bar, and a `should_continue()` loop guard for the time and repetition modes. |
