convnettrainer
Module
ConvnetTrainer
class makes use of hooks. Hooks are a collection of methods which provide
quick access to exact entry in loop. In this way, we can override these methods with custom functionality
in either training, evaluation or test loops.
Non-lifecycle hooks
Methods to initalize class attributes
Docs
-
class
farabio.core.convnettrainer.
ConvnetTrainer
(config)[source]
ConvnetTrainer is main trainer class for every ConvNet related
architectures.
- Parameters
- BaseTrainerABC
Inherits BaseTrainer class
-
__init__
(config)[source]
Initializes trainer object
-
default_attr
(*args)[source]
-
init_attr
(*args)[source]
Abstract method that initializes object attributes
-
define_data_attr
(*args)[source]
Define data related attributes here
-
define_model_attr
(*args)[source]
Define model related attributes here
-
define_train_attr
(*args)[source]
Define training related attributes here
-
define_test_attr
(*args)[source]
Define training related attributes here
-
define_log_attr
(*args)[source]
Define log related attributes here
-
define_compute_attr
(*args)[source]
Define compute related attributes here
-
define_misc_attr
(*args)[source]
Define miscellaneous attributes here
-
build_model
(*args)[source]
Abstract method that builds model
-
build_parallel_model
(*args)[source]
Abstract method that builds multi-GPU model in parallel
-
get_trainloader
(*args)[source]
Hook: Retreives training set of torch.utils.data.DataLoader class
-
get_testloader
(*args)[source]
Hook: Retreives test set of torch.utils.data.DataLoader class
-
train
()[source]
Training loop with hooksa
-
train_loop
()[source]
Hook: training loop
-
train_epoch
()[source]
Hook: epoch of training loop
-
train_batch
(args)[source]
Hook: batch of training loop
-
on_train_start
()[source]
Hook: On start of training loop
-
start_logger
(*args)[source]
Hook: Starts logger
-
on_train_epoch_start
()[source]
Hook: On epoch start
-
on_start_training_batch
(*args)[source]
Hook: On training batch start
-
optimizer_zero_grad
(*args)[source]
Hook: Zero gradients of optimizer
-
training_step
(*args)[source]
Hook: During training batch
-
loss_backward
(*args)[source]
Hook: Loss back-propagation
-
optimizer_step
()[source]
Hook: Optimizer step
-
on_end_training_batch
(*args)[source]
Hook: On end of training batch
-
on_train_epoch_end
(*args)[source]
Hook: On end of training epoch
-
on_train_end
()[source]
Hook: On end of training
-
on_epoch_end
(*args)[source]
Hook: on epoch end
-
stop_train
(*args)[source]
On end of training
-
evaluate_epoch
()[source]
Hook: epoch of evaluation loop
- Parameters
- epochint
Current epoch
-
evaluate_batch
(*args)[source]
Hook: batch of evaluation loop
-
on_evaluate_start
(*args)[source]
Hook: on evaluation end
-
on_evaluate_epoch_start
()[source]
Hook: on evaluation start
-
on_evaluate_batch_start
(*args)[source]
-
on_evaluate_batch_end
()[source]
Hook: On evaluate batch end
-
on_evaluate_epoch_end
(*args)[source]
-
on_evaluate_end
(*args)[source]
Hook: on evaluation end
-
test
()[source]
Hook: Test lifecycle
-
test_loop
()[source]
Hook: test loop
-
on_test_start
(*args)[source]
Hook: on test start
-
on_start_test_batch
(*args)[source]
Hook: on test batch start
-
test_step
(*args)[source]
Test action (Put test here)
-
on_end_test_batch
(*args)[source]
Hook: on end of batch test
-
on_test_end
(*args)[source]
Hook: on end test
-
load_model
(*args)[source]
Hook: load model
-
load_parallel_model
(*args)[source]
Hook: load parallel model
-
save_model
(*args)[source]
Hook: saves model
-
save_parallel_model
(*args)[source]
Hook: saves parallel model
-
exit_trainer
(*args)[source]
Exits trainer