class
TQDMProgressBar
PythonTQDMProgressBar( 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:
import timeimport helia_edge as helia
# Create a TQDM progress barpb_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 trainingepochs = 10steps = 5pb_callback.set_params(dict(epochs=epochs, steps=steps))pb_callback.on_train_begin()loss = 1.0accuracy = 0.0for 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. |
attribute
metrics_separator
Pythonmetrics_separator = metrics_separatorattribute
overall_bar_format
Pythonoverall_bar_format = overall_bar_formatattribute
epoch_bar_format
Pythonepoch_bar_format = epoch_bar_formatattribute
leave_epoch_progress
Pythonleave_epoch_progress = leave_epoch_progressattribute
leave_overall_progress
Pythonleave_overall_progress = leave_overall_progressattribute
show_epoch_progress
Pythonshow_epoch_progress = show_epoch_progressattribute
show_overall_progress
Pythonshow_overall_progress = show_overall_progressattribute
metrics_format
Pythonmetrics_format = metrics_formatattribute
update_interval
Pythonupdate_interval = 1 / update_per_secondattribute
last_update_time
Pythonlast_update_time = time.time()attribute
overall_progress_tqdm
Pythonoverall_progress_tqdm = Noneattribute
epoch_progress_tqdm
Pythonepoch_progress_tqdm = Noneattribute
is_training
Pythonis_training = Falseattribute
num_epochs
Pythonnum_epochs = Noneattribute
logs
Pythonlogs = Nonemethod
on_train_begin
Pythonon_train_begin(logs=None)method
on_train_end
Pythonon_train_end(logs={})method
on_test_begin
Pythonon_test_begin(logs={})method
on_test_end
Pythonon_test_end(logs={})method
on_epoch_begin
Pythonon_epoch_begin(epoch, logs={})method
on_epoch_end
Pythonon_epoch_end(epoch, logs={})method
on_test_batch_end
Pythonon_test_batch_end(batch, logs={})method
on_batch_end
Pythonon_batch_end(batch, logs={})method
format_metrics
PythonFormat metrics in logs into a string.
format_metrics(logs: dict = {}, factor=1) -> strFormat 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
| Value | Type | Description |
|---|---|---|
metrics_string | str | a string displaying metrics using the given |
str | formators passed in through the constructor. |
method
get_config
Pythonget_config()