applying profiling to the fastai learner callback functions
FastAI Training Event Lifecycle Methods
after_create
before_fit
before_epoch
before_train
before_batch
after_pred
after_loss
before_backward
after_backward
after_cancel_step
after_step
after_cancel_batch
after_batch
after_cancel_train
after_train
before_validate
before_batch
after_pred
after_loss
after_cancel_batch
after_batch
after_cancel_validate
after_validate
after_epoch
after_cancel_fit
after_fit
from fastai.vision.all import *
path = untar_data(URLs.MNIST_TINY)
Path.BASE_PATH = path
datablock = DataBlock(
blocks=(ImageBlock,CategoryBlock),
get_items=get_image_files,
get_y=parent_label,
splitter=GrandparentSplitter(),
item_tfms=Resize(28),
batch_tfms=[]
)
dls = datablock.dataloaders(path)
learner = cnn_learner(dls,resnet18,metrics=accuracy)
learner.summary()
learner.to_my_profile()
learner.my_profile
learner.my_profile.print_stats()
learner.fit(1)
learner.my_profile.print_stats()
fit_stats = learner.my_profile.get_stats();fit_stats
learner.my_profile.print_stats('train_batch')
train_batch_stats = learner.my_profile.get_stats('train_batch'); train_batch_stats
learner.my_profile.clear_stats()
learner.my_profile.print_stats()
learner.my_profile.print_stats('train')
learner.fine_tune(1)
learner.my_profile.print_stats()
learner.my_profile.reset = True
learner.fine_tune(1)
learner.my_profile.print_stats()
learner.my_profile.reset