TQDMProgressBar#
- class deeplay.callbacks.progress.TQDMProgressBar(refresh_rate: int = 1)#
Bases:
TQDMProgressBarA progress bar for displaying training progress with TQDM.
This class enhances the standard Lightning TQDMProgressBar by providing environment-specific adjustments to prevent potential crashes on platforms like Colab and Kaggle.
Parameters#
- refresh_rateint, optional
The refresh rate of the progress bar, by default 1.
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. tqdm_bar = dl.callbacks.TQDMProgressBar(refresh_rate=100) trainer = dl.Trainer(max_epochs=100, callbacks=[tqdm_bar]) trainer.fit(classifier, dataloader) ```