PINA Progress Bar#

Module for the Processing Callbacks.

class PINAProgressBar(metrics='val', **kwargs)[source]#

Bases: TQDMProgressBar

Custom progress bar callback for PINA training workflows.

This callback extends the default Lightning progress bar by filtering the displayed metrics.

Metrics can refer either to condition-specific losses, identified by the names assigned to the problem conditions, or to global losses. Global losses are selected using "train", "val", or "test", and are internally expanded to the corresponding logged loss metrics.

Initialization of the PINAProgressBar.

Parameters:
  • metrics (str | list(str) | tuple(str)) – The names of the metrics to be shown in the progress bar. Each entry can be either a key of a condition defined in the problem or one of the global loss keys: "train", "val", or "test". These global keys are internally expanded to the corresponding logged loss names. Default is "val".

  • kwargs (dict) – Additional keyword arguments passed to lightning.pytorch.callbacks.TQDMProgressBar.

Raises:

TypeError – If metrics contains non-string elements.

get_metrics(trainer, __)[source]#

Retrieve and filter metrics to be displayed in the progress bar.

This method combines standard Lightning metrics with user-selected progress bar metrics, retaining only the metrics specified at initialization.

Parameters:
  • trainer (Trainer) – The trainer managing the training loop.

  • __ – Placeholder argument, not used.

Returns:

Dictionary containing the metrics to display.

Return type:

dict

Note

This method overrides the default Lightning behavior. It can be further customized by subclassing.

setup(trainer, pl_module, stage)[source]#

Configure the metrics to track before execution starts.

The requested metrics must be either names assigned to problem conditions or global loss keys. The accepted global loss keys are "train", "val", and "test".

Parameters:
  • trainer (Trainer) – The trainer instance managing the execution.

  • pl_module (BaseSolver) – The solver module being executed.

  • stage (str) – Current execution stage.

Raises:

KeyError – If a metric key is neither a condition key nor one of "train", "val", or "test".