# helia_edge.callbacks.tqdm_progress_bar

## TQDMProgressBar

## helia_edge.callbacks.tqdm_progress_bar.TQDMProgressBar

`class` · `python`

```python
TQDMProgressBar(
    metrics_separator: str = ' - ',
    overall_bar_format: str = '{l_bar}{bar} {n_fmt}/{total_fmt} ETA: {remaining}s,  {rate_fmt}{postfix}',
    epoch_bar_format: str = '{n_fmt}/{total_fmt}{bar} ETA: {remaining}s - {desc}',
    metrics_format: str = '{name}: {value:0.4f}',
    update_per_second: int = 10,
    leave_epoch_progress: bool = True,
    leave_overall_progress: bool = True,
    show_epoch_progress: bool = True,
    show_overall_progress: bool = True,
)
```

TQDM Progress Bar callback.

Example:

```python

import time
import helia_edge as helia

# Create a TQDM progress bar
pb_callback = helia.callbacks.TQDMProgressBar(
    overall_bar_format="{l_bar}{bar} {n_fmt}/{total_fmt},  {rate_fmt}{postfix}",
    epoch_bar_format="{n_fmt}/{total_fmt}{bar} - {desc}",
    metrics_format="{name}: {value:0.4f}",
    update_per_second=10,
    leave_epoch_progress=True,
)

# Simulate training
epochs = 10
steps = 5
pb_callback.set_params(dict(epochs=epochs, steps=steps))
pb_callback.on_train_begin()
loss = 1.0
accuracy = 0.0
for epoch in range(epochs):
    pb_callback.on_epoch_begin(epoch)
    for step in range(steps):
        loss -= epoch * step / (epochs * steps)
        accuracy += epoch * step / (epochs * steps)
        pb_callback.on_batch_end(step, {"loss": loss, "accuracy": accuracy})
        time.sleep(0.1)
    pb_callback.on_epoch_end(epoch, {"loss": loss, "accuracy": accuracy})
pb_callback.on_train_end()
```

**Parameters**

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| metrics_separator | str | ' - ' | Custom separator between metrics. Defaults to ' - '. |
| overall_bar_format | str | '{l_bar}{bar} {n_fmt}/{total_fmt} ETA: {remaining}s,  {rate_fmt}{postfix}' | Custom bar format for overall (outer) progress bar, see https://github.com/tqdm/tqdm#parameters for more detail. |
| epoch_bar_format | str | '{n_fmt}/{total_fmt}{bar} ETA: {remaining}s - {desc}' | Custom bar format for epoch (inner) progress bar, see https://github.com/tqdm/tqdm#parameters for more detail. |
| update_per_second | int | 10 | Maximum number of updates in the epochs bar per second, this is to prevent small batches from slowing down training. Defaults to 10. |
| metrics_format | str | '{name}: {value:0.4f}' | Custom format for how metrics are formatted. See https://github.com/tqdm/tqdm#parameters for more detail. |
| leave_epoch_progress | bool | True | `True` to leave epoch progress bars. |
| leave_overall_progress | bool | True | `True` to leave overall progress bar. |
| show_epoch_progress | bool | True | `False` to hide epoch progress bars. |
| show_overall_progress | bool | True | `False` to hide overall progress bar. |

Source: `helia_edge/callbacks/tqdm_progress_bar.py:15`

### helia_edge.callbacks.tqdm_progress_bar.TQDMProgressBar.metrics_separator

`attribute` · `python`

```python
metrics_separator = metrics_separator
```

Source: `helia_edge/callbacks/tqdm_progress_bar.py:85`

### helia_edge.callbacks.tqdm_progress_bar.TQDMProgressBar.overall_bar_format

`attribute` · `python`

```python
overall_bar_format = overall_bar_format
```

Source: `helia_edge/callbacks/tqdm_progress_bar.py:86`

### helia_edge.callbacks.tqdm_progress_bar.TQDMProgressBar.epoch_bar_format

`attribute` · `python`

```python
epoch_bar_format = epoch_bar_format
```

Source: `helia_edge/callbacks/tqdm_progress_bar.py:87`

### helia_edge.callbacks.tqdm_progress_bar.TQDMProgressBar.leave_epoch_progress

`attribute` · `python`

```python
leave_epoch_progress = leave_epoch_progress
```

Source: `helia_edge/callbacks/tqdm_progress_bar.py:88`

### helia_edge.callbacks.tqdm_progress_bar.TQDMProgressBar.leave_overall_progress

`attribute` · `python`

```python
leave_overall_progress = leave_overall_progress
```

Source: `helia_edge/callbacks/tqdm_progress_bar.py:89`

### helia_edge.callbacks.tqdm_progress_bar.TQDMProgressBar.show_epoch_progress

`attribute` · `python`

```python
show_epoch_progress = show_epoch_progress
```

Source: `helia_edge/callbacks/tqdm_progress_bar.py:90`

### helia_edge.callbacks.tqdm_progress_bar.TQDMProgressBar.show_overall_progress

`attribute` · `python`

```python
show_overall_progress = show_overall_progress
```

Source: `helia_edge/callbacks/tqdm_progress_bar.py:91`

### helia_edge.callbacks.tqdm_progress_bar.TQDMProgressBar.metrics_format

`attribute` · `python`

```python
metrics_format = metrics_format
```

Source: `helia_edge/callbacks/tqdm_progress_bar.py:92`

### helia_edge.callbacks.tqdm_progress_bar.TQDMProgressBar.update_interval

`attribute` · `python`

```python
update_interval = 1 / update_per_second
```

Source: `helia_edge/callbacks/tqdm_progress_bar.py:95`

### helia_edge.callbacks.tqdm_progress_bar.TQDMProgressBar.last_update_time

`attribute` · `python`

```python
last_update_time = time.time()
```

Source: `helia_edge/callbacks/tqdm_progress_bar.py:97`

### helia_edge.callbacks.tqdm_progress_bar.TQDMProgressBar.overall_progress_tqdm

`attribute` · `python`

```python
overall_progress_tqdm = None
```

Source: `helia_edge/callbacks/tqdm_progress_bar.py:98`

### helia_edge.callbacks.tqdm_progress_bar.TQDMProgressBar.epoch_progress_tqdm

`attribute` · `python`

```python
epoch_progress_tqdm = None
```

Source: `helia_edge/callbacks/tqdm_progress_bar.py:99`

### helia_edge.callbacks.tqdm_progress_bar.TQDMProgressBar.is_training

`attribute` · `python`

```python
is_training = False
```

Source: `helia_edge/callbacks/tqdm_progress_bar.py:100`

### helia_edge.callbacks.tqdm_progress_bar.TQDMProgressBar.num_epochs

`attribute` · `python`

```python
num_epochs = None
```

Source: `helia_edge/callbacks/tqdm_progress_bar.py:101`

### helia_edge.callbacks.tqdm_progress_bar.TQDMProgressBar.logs

`attribute` · `python`

```python
logs = None
```

Source: `helia_edge/callbacks/tqdm_progress_bar.py:102`

### helia_edge.callbacks.tqdm_progress_bar.TQDMProgressBar.on_train_begin

`method` · `python`

```python
on_train_begin(logs=None)
```

Source: `helia_edge/callbacks/tqdm_progress_bar.py:191`

### helia_edge.callbacks.tqdm_progress_bar.TQDMProgressBar.on_train_end

`method` · `python`

```python
on_train_end(logs={})
```

Source: `helia_edge/callbacks/tqdm_progress_bar.py:195`

### helia_edge.callbacks.tqdm_progress_bar.TQDMProgressBar.on_test_begin

`method` · `python`

```python
on_test_begin(logs={})
```

Source: `helia_edge/callbacks/tqdm_progress_bar.py:199`

### helia_edge.callbacks.tqdm_progress_bar.TQDMProgressBar.on_test_end

`method` · `python`

```python
on_test_end(logs={})
```

Source: `helia_edge/callbacks/tqdm_progress_bar.py:203`

### helia_edge.callbacks.tqdm_progress_bar.TQDMProgressBar.on_epoch_begin

`method` · `python`

```python
on_epoch_begin(epoch, logs={})
```

Source: `helia_edge/callbacks/tqdm_progress_bar.py:207`

### helia_edge.callbacks.tqdm_progress_bar.TQDMProgressBar.on_epoch_end

`method` · `python`

```python
on_epoch_end(epoch, logs={})
```

Source: `helia_edge/callbacks/tqdm_progress_bar.py:210`

### helia_edge.callbacks.tqdm_progress_bar.TQDMProgressBar.on_test_batch_end

`method` · `python`

```python
on_test_batch_end(batch, logs={})
```

Source: `helia_edge/callbacks/tqdm_progress_bar.py:215`

### helia_edge.callbacks.tqdm_progress_bar.TQDMProgressBar.on_batch_end

`method` · `python`

```python
on_batch_end(batch, logs={})
```

Source: `helia_edge/callbacks/tqdm_progress_bar.py:219`

### helia_edge.callbacks.tqdm_progress_bar.TQDMProgressBar.format_metrics

`method` · `python`

```python
format_metrics(logs: dict = {}, factor=1) -> str
```

Format metrics in logs into a string.

**Parameters**

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| logs | dict | {} | dictionary of metrics and their values. Defaults to empty dictionary. |
| factor | int | 1 | The factor we want to divide the metrics in logs by, useful when we are computing the logs after each batch. Defaults to 1. |

**Returns**

| Name | Type | Description |
| --- | --- | --- |
| metrics_string | str | a string displaying metrics using the given |
|  | str | formators passed in through the constructor. |

Source: `helia_edge/callbacks/tqdm_progress_bar.py:222`

### helia_edge.callbacks.tqdm_progress_bar.TQDMProgressBar.get_config

`method` · `python`

```python
get_config()
```

Source: `helia_edge/callbacks/tqdm_progress_bar.py:246`
