Learning Rate Finder
This package can be used to find optimal learning rate given a range (maximum and minimum learning rate)
The package includes LearningRateFinder() class which implements the fit, find_optimal_lr method. The fit() method is used to train a given model using varied learning rates within a range (optional args)
Installation
To install with pip run the following command
pip install tanjid-lr-finder
Dependencies
This package requires numpy, pandas, matplotlib and pytorch to be installed.
Instruction for usage
LearningRateFinder takes instantiated pytorch models (nn.module), criterion and optimizer (torch.optim).
The fit method requires a dataloader (torch.utils.data.DataLoader), you can optionally include the number of epochs, the starting and ending learning rate. The plot() function can be used to visualize the results in a plot. Please follow the example below for reference.
lrf = LearningRateFinder(model, criterion, optimizer)
lrf.fit(train_loader, 100)
lrf.plot()