RichProgressBar#
- class deeplay.callbacks.progress.RichProgressBar(refresh_rate: int = 1, leave: bool = False, theme: RichProgressBarTheme = RichProgressBarTheme(description='', progress_bar='#6206E0', progress_bar_finished='#6206E0', progress_bar_pulse='#6206E0', batch_progress='', time='dim', processing_speed='dim underline', metrics='italic', metrics_text_delimiter=' ', metrics_format='.3g'), console_kwargs=None)#
Bases:
RichProgressBarA progress bar for displaying training progress with Rich.
This class enhances the standard Lightning RichProgressBar by supporting customizable themes and console options. It includes an environment-specific adjustment to prevent potential crashes on platforms like Colab and Kaggle.
Parameters#
- refresh_rateint, optional
The refresh rate of the progress bar, by default 1.
- leavebool, optional
Whether to leave the progress bar on the screen after completion, by default False.
- themeRichProgressBarTheme, optional
The theme used for the Rich progress bar, by default RichProgressBarTheme(metrics_format=”.3g”).
- console_kwargsdict, optional
Additional keyword arguments for configuring the Rich console, by default None.
Example#
This example demosntrate the use of the standard TQDM progress bar:
```python import deeplay as dl import torch
# Create training dataset. num_samples = 10 ** 4 data = torch.randn(num_samples, 2) labels = (data.sum(dim=1) > 0).long()
dataset = torch.utils.data.TensorDataset(data, labels) dataloader = dl.DataLoader(dataset, batch_size=16, shuffle=True)
# Create neural network and classifier application. mlp = dl.MediumMLP(in_features=2, out_features=2) classifier = dl.Classifier(mlp, optimizer=dl.Adam(), num_classes=2).build()
# Train neural network with progress bar. rich_bar = dl.callbacks.RichProgressBar(refresh_rate=100) trainer = dl.Trainer(max_epochs=100, callbacks=[rich_bar]) trainer.fit(classifier, dataloader) ```