Synthetic Learner

For quick testing of the training loop and Callbacks

synth_dbunch

 synth_dbunch (a=2, b=3, bs=16, n_train=10, n_valid=2, cuda=False)

RegModel

 RegModel ()

Same as nn.Module, but no need for subclasses to call super().__init__


synth_learner

 synth_learner (n_trn=10, n_val=2, cuda=False, lr=0.001, data=None,
                model=None, loss_func:'callable|None'=None,
                opt_func=<functionAdamat0x7ff01a1fb370>, splitter:'callabl
                e'=<functiontrainable_paramsat0x7ff01c2163b0>, cbs=None,
                metrics=None, path=None, model_dir='models', wd=None,
                wd_bn_bias=False, train_bn=True, moms=(0.95,0.85,0.95),
                default_cbs:'bool'=True)
Type Default Details
n_trn int 10
n_val int 2
cuda bool False
lr float 0.001 Learning rate passed to Learner.__init__
data NoneType None
model NoneType None The model to train or use for inference passed to Learner.__init__
loss_func callable | None None Loss function for training passed to Learner.__init__
opt_func function Adam Optimisation function for training passed to Learner.__init__
splitter callable trainable_params Used to split parameters into layer groups passed to Learner.__init__
cbs NoneType None Callbacks passed to Learner.__init__
metrics NoneType None Printed after each epoch passed to Learner.__init__
path NoneType None Parent directory to save, load, and export models passed to Learner.__init__
model_dir str models Subdirectory to save and load models passed to Learner.__init__
wd NoneType None Weight decay passed to Learner.__init__
wd_bn_bias bool False Apply weight decay to batchnorm bias params? passed to Learner.__init__
train_bn bool True Always train batchnorm layers? passed to Learner.__init__
moms tuple (0.95, 0.85, 0.95) Momentum passed to Learner.__init__
default_cbs bool True Include default callbacks? passed to Learner.__init__

VerboseCallback

 VerboseCallback (after_create=None, before_fit=None, before_epoch=None,
                  before_train=None, before_batch=None, after_pred=None,
                  after_loss=None, before_backward=None,
                  after_cancel_backward=None, after_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 that prints the name of each event called

Install Utils


get_env

 get_env (name)

Return env var value if it’s defined and not an empty string, or return Unknown


try_import

 try_import (module)

Try to import module. Returns module’s object on success, None on failure


nvidia_smi

 nvidia_smi (cmd='nvidia-smi')
res = nvidia_smi()

nvidia_mem

 nvidia_mem ()
nvidia_mem()
['48600', '7982']

show_install

 show_install (show_nvidia_smi:bool=False)

Print user’s setup information

- Export