Skip to content

Logging

Source

Logging submodule.

The methods are responsible for the in-console logger.

ProgressBar

Keras style progress bar.

Adapted from https://github.com/yueyericardo/pkbar.

Parameters:

Name Type Description Default
max_value Optional[int]

Maximum progress bar value, by default None.

None
epoch Optional[int]

Zero-indexed current epoch, by default None.

None
num_epochs Optional[int]

Total number of epochs, by default None.

None
stateful_metrics Optional[list]

Iterable of string names of metrics that should not be averaged over time. Metrics in this list will be displayed as-is. All others will be averaged by the progress bar before display, by default None.

None
always_stateful bool
Whether to set all metrics to be stateful, by default False.
False
mode str

Mode, one of "train", "val", or "predict", by default "train".

'train'

add(n, values=None)

Update the progress bar by n steps.

Parameters:

Name Type Description Default
n int

Number of steps to increase the progress bar with.

required
values Optional[list]

Updated metrics values, by default None.

None

spinning_cursor()

Generate a spinning cursor animation.

Taken from https://github.com/manrajgrover/py-spinners/tree/master.

Returns:

Type Description
Generator

Generator of animation frames.

update(current_step, batch_size=1, values=None)

Update the progress bar.

Parameters:

Name Type Description Default
current_step int

Index of the current step.

required
batch_size int

Batch size, by default 1.

1
values Optional[list]

Updated metrics values, by default None.

None

get_logger(name, log_level=logging.INFO, log_path=None)

Create a python logger instance with configured handlers.

Parameters:

Name Type Description Default
name str

Name of the logger.

required
log_level int

Log level (info, error etc.), by default logging.INFO.

INFO
log_path Optional[Union[str, Path]]

Path in which to save the log, by default None.

None

Returns:

Type Description
Logger

Logger.