AzureMLProgressBar
- class health_ml.utils.AzureMLProgressBar(refresh_rate=50, print_timestamp=True, write_to_logging_info=False)[source]
Bases:
pytorch_lightning.callbacks.progress.base.ProgressBarBase
A PL progress bar that works better in AzureML. It prints timestamps for each message, and works well with a setup where there is no direct access to the console.
- Usage example:
>>> from health_ml.utils import AzureMLProgressBar >>> from pytorch_lightning import Trainer >>> progress = AzureMLProgressBar(refresh_rate=100) >>> trainer = Trainer(callbacks=[progress])
- Parameters
refresh_rate (
int
) – The number of steps after which the progress should be printed out.print_timestamp (
bool
) – If True, each message that the progress bar prints will be prefixed with the current time in UTC. If False, no such prefix will be added.write_to_logging_info (
bool
) – If True, the progress information will be printed via logging.info. If False, it will be printed to stdout via print.
Attributes Summary
A string that indicates that the trainer loop is presently in prediction mode.
A string that indicates that the trainer loop is presently in testing mode.
A string that indicates that the trainer loop is presently in training mode.
A string that indicates that the trainer loop is presently in validation mode.
- rtype
bool
- rtype
bool
- rtype
int
Methods Summary
disable
()You should provide a way to disable the progress bar.
enable
()You should provide a way to enable the progress bar.
on_predict_batch_end
(*args, **kwargs)Called when the predict batch ends.
on_predict_epoch_start
(trainer, pl_module)Called when the predict epoch begins.
on_test_batch_end
(*args, **kwargs)Called when the test batch ends.
on_test_epoch_start
(trainer, pl_module)Called when the test epoch begins.
on_train_batch_end
(*args, **kwargs)Called when the train batch ends.
on_train_epoch_start
(trainer, pl_module)Called when the train epoch begins.
on_validation_batch_end
(*args, **kwargs)Called when the validation batch ends.
on_validation_start
(trainer, pl_module)Called when the validation loop begins.
start_stage
(stage, total_num_batches)Sets the information that a new stage of the PL loop is starting.
update_progress
(batches_processed)Writes progress information once the refresh interval is full.
Attributes Documentation
- PROGRESS_STAGE_PREDICT = 'Prediction'
A string that indicates that the trainer loop is presently in prediction mode.
- PROGRESS_STAGE_TEST = 'Testing'
A string that indicates that the trainer loop is presently in testing mode.
- PROGRESS_STAGE_TRAIN = 'Training'
A string that indicates that the trainer loop is presently in training mode.
- PROGRESS_STAGE_VAL = 'Validation'
A string that indicates that the trainer loop is presently in validation mode.
- is_disabled
- Return type
bool
- is_enabled
- Return type
bool
- refresh_rate
- Return type
int
Methods Documentation
- disable()[source]
You should provide a way to disable the progress bar.
The
Trainer
will call this to disable the output on processes that have a rank different from 0, e.g., in multi-node training.- Return type
None
- enable()[source]
You should provide a way to enable the progress bar.
The
Trainer
will call this in e.g. pre-training routines like the learning rate finder to temporarily enable and disable the main progress bar.- Return type
None
- on_predict_epoch_start(trainer, pl_module)[source]
Called when the predict epoch begins.
- Return type
None
- on_test_epoch_start(trainer, pl_module)[source]
Called when the test epoch begins.
- Return type
None
- on_train_epoch_start(trainer, pl_module)[source]
Called when the train epoch begins.
- Return type
None
- on_validation_batch_end(*args, **kwargs)[source]
Called when the validation batch ends.
- Return type
None
- on_validation_start(trainer, pl_module)[source]
Called when the validation loop begins.
- Return type
None
- start_stage(stage, total_num_batches)[source]
Sets the information that a new stage of the PL loop is starting. The stage will be available in self.stage, total_num_batches in self.total_num_batches. The time when this method was called is recorded in self.stage_start_time
- Parameters
stage (
str
) – The string name of the stage that has just started.total_num_batches (
int
) – The total number of batches that need to be processed in this stage. This is used only for progress reporting.
- Return type
None