pytorch_pfn_extras.training.extensions.ProgressBar#

class pytorch_pfn_extras.training.extensions.ProgressBar(training_length=None, update_interval=100, bar_length=50, out=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>)#

Bases: Extension

An extension to print a progress bar and recent training status.

This extension prints a progress bar at every call. It watches the current iteration and epoch to print the bar.

Parameters:
  • training_length (tuple or None) – Length of whole training. It consists of an integer and either 'epoch' or 'iteration'. If this value is omitted and the stop trigger of the manager is IntervalTrigger, this extension uses its attributes to determine the length of the training.

  • update_interval (int) – Number of iterations to skip printing the progress bar.

  • bar_length (int) – Length of the progress bar in characters.

  • out (Any) – Stream to print the bar. Standard output is used by default.

Methods

__init__([training_length, update_interval, ...])

finalize(manager)

Finalizes the extension.

initialize(manager)

Initializes up the manager state.

load_state_dict(to_load)

on_error(manager, exc, tb)

Handles the error raised during training before finalization.

state_dict()

Serializes the extension state.

Attributes

default_name

Default name of the extension.

is_async

name

needs_model_state

priority

trigger

__call__(manager)#

Invokes the extension.

Implementations should override this operator. This method is called at iterations which the corresponding trigger accepts.

Parameters:

manager (ExtensionsManager) – Manager object to call this operator.

Return type:

None

__init__(training_length=None, update_interval=100, bar_length=50, out=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>)#
Parameters:
  • training_length (Optional[Any]) –

  • update_interval (int) –

  • bar_length (int) –

  • out (Any) –

finalize(manager)#

Finalizes the extension.

This method is called at the end of the training loop.

Parameters:

manager (ExtensionsManagerProtocol) –

Return type:

None