transformer_trainer Module

../_images/vit.png

TransformerTrainer class uses Basic Linformer architecture, which is originally proposed in this arXiv 1. Implemented trainer module uses this Git 2 code as reference work.

References

1

https://arxiv.org/abs/2006.04768

2

https://github.com/lucidrains/vit-pytorch

TransformerTrainer class

class farabio.models.classification.transformer_trainer.TransformerTrainer(config)[source]

Classification trainer class. Override with custom methods here.

Parameters
ConvnetTrainerBaseTrainer

Inherits ConvnetTrainer class

define_data_attr(*args)[source]

Define data related attributes here

define_train_attr()[source]

Define training related attributes here

define_model_attr(*args)[source]

Define model related attributes here

define_compute_attr(*args)[source]

Define compute related attributes here

define_misc_attr()[source]

Define miscellaneous attributes here

seed_everything()[source]
get_trainloader()[source]

Hook: Retreives training set of torch.utils.data.DataLoader class

get_testloader()[source]

Hook: Retreives test set of torch.utils.data.DataLoader class

build_model()[source]

Abstract method that builds model

on_train_epoch_start()[source]

Hook: On epoch start

on_start_training_batch(args)[source]

Hook: On training batch start

training_step()[source]

Hook: During training batch

on_end_training_batch()[source]

Hook: On end of training batch

optimizer_zero_grad()[source]

Hook: Zero gradients of optimizer

optimizer_step()[source]

Hook: Optimizer step

loss_backward()[source]

Hook: Loss back-propagation

on_evaluate_epoch_start()[source]

Hook: on evaluation start

on_evaluate_batch_start(args)[source]
evaluate_batch(args)[source]

Hook: batch of evaluation loop

on_evaluate_batch_end()[source]

Hook: On evaluate batch end

on_epoch_end()[source]

Hook: on epoch end