= nvidia_smi() res
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:Optimizer|OptimWrapper=<function Adam>, splitter:Callable=<function trainable_params>, cbs:Callback|MutableSequence|None=None, metrics:Callable|MutableSequence|None=None, path:str|Path|None=None, model_dir:str|Path='models', wd:float|int|None=None, wd_bn_bias:bool=False, train_bn:bool=True, moms:tuple=(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 | slice | 0.001 | Default learning rate |
data | NoneType | None | |
model | Callable | PyTorch model for training or inference | |
loss_func | Optional | None | Loss function. Defaults to dls loss |
opt_func | fastai.optimizer.Optimizer | fastai.optimizer.OptimWrapper | Adam | Optimization function for training |
splitter | Callable | trainable_params | Split model into parameter groups. Defaults to one parameter group |
cbs | fastai.callback.core.Callback | collections.abc.MutableSequence | None | None | Callback s to add to Learner |
metrics | Union | None | Metric s to calculate on validation set |
path | str | pathlib.Path | None | None | Parent directory to save, load, and export models. Defaults to dls path |
model_dir | str | pathlib.Path | models | Subdirectory to save and load models |
wd | float | int | None | None | Default weight decay |
wd_bn_bias | bool | False | Apply weight decay to normalization and bias parameters |
train_bn | bool | True | Train frozen normalization layers |
moms | tuple | (0.95, 0.85, 0.95) | Default momentum for schedulers |
default_cbs | bool | True | Include default Callback s |
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')
nvidia_mem
nvidia_mem ()
nvidia_mem()
['48600', '7982']
show_install
show_install (show_nvidia_smi:bool=False)
Print user’s setup information