Very basic Callbacks to enhance the training experience including CUDA support

class ProgressCallback[source]

ProgressCallback(after_create=None, before_fit=None, before_epoch=None, before_train=None, before_batch=None, after_pred=None, after_loss=None, before_backward=None, before_step=None, after_cancel_step=None, after_step=None, after_cancel_batch=None, after_batch=None, after_cancel_train=None, after_train=None, before_validate=None, after_cancel_validate=None, after_validate=None, after_cancel_epoch=None, after_epoch=None, after_cancel_fit=None, after_fit=None) :: Callback

A Callback to handle the display of progress bars

learn = synth_learner()
learn.fit(5)
epoch train_loss valid_loss time
0 10.118802 8.174870 00:00
1 10.075614 8.114030 00:00
2 10.035525 8.052789 00:00
3 9.972941 7.991217 00:00
4 9.917836 7.931038 00:00
/mnt/d/lib/python3.7/site-packages/torch/autograd/__init__.py:132: UserWarning: CUDA initialization: Found no NVIDIA driver on your system. Please check that you have an NVIDIA GPU and installed a driver from http://www.nvidia.com/Download/index.aspx (Triggered internally at  /pytorch/c10/cuda/CUDAFunctions.cpp:100.)
  allow_unreachable=True)  # allow_unreachable flag

Learner.no_bar[source]

Learner.no_bar()

Context manager that deactivates the use of progress bars

learn = synth_learner()
with learn.no_bar(): learn.fit(5)
[0, 20.658222198486328, 24.910701751708984, '00:00']
[1, 20.54644775390625, 24.757198333740234, '00:00']
[2, 20.48363494873047, 24.60427474975586, '00:00']
[3, 20.415714263916016, 24.45093536376953, '00:00']
[4, 20.329593658447266, 24.297313690185547, '00:00']

ProgressCallback.before_fit[source]

ProgressCallback.before_fit()

Setup the master bar over the epochs

The history saving thread hit an unexpected error (OperationalError('disk I/O error')).History will not be written to the database.

ProgressCallback.before_epoch[source]

ProgressCallback.before_epoch()

Update the master bar

ProgressCallback.before_train[source]

ProgressCallback.before_train()

Launch a progress bar over the training dataloader

ProgressCallback.before_validate[source]

ProgressCallback.before_validate()

Launch a progress bar over the validation dataloader

ProgressCallback.after_batch[source]

ProgressCallback.after_batch()

Update the current progress bar

ProgressCallback.after_train[source]

ProgressCallback.after_train()

Close the progress bar over the training dataloader

ProgressCallback.after_validate[source]

ProgressCallback.after_validate()

Close the progress bar over the validation dataloader

ProgressCallback.after_fit[source]

ProgressCallback.after_fit()

Close the master bar

class CollectDataCallback[source]

CollectDataCallback(after_create=None, before_fit=None, before_epoch=None, before_train=None, before_batch=None, after_pred=None, after_loss=None, before_backward=None, before_step=None, after_cancel_step=None, after_step=None, after_cancel_batch=None, after_batch=None, after_cancel_train=None, after_train=None, before_validate=None, after_cancel_validate=None, after_validate=None, after_cancel_epoch=None, after_epoch=None, after_cancel_fit=None, after_fit=None) :: Callback

Collect all batches, along with pred and loss, into self.data. Mainly for testing

class CudaCallback[source]

CudaCallback(device=None) :: Callback

Move data to CUDA device