Optimum learning rate finder for PyTorch Models
Project description
PyTorch Learning Rate Tuner
Python package to plot loss against varied learning rate for PyTorch neural network models and finding optimal learning rate for specific optimizer.
Installation:
pip install pytorch-lr-tuner
Dependency:
- Python 3.6
- Numpy
- Pandas
- Matplotlib
- PyTorch
Example:
The package includes LearningRateFinder class which can be instantiated with pytorch model reference, optimizer, criterion and training set. The fit() method searches for optimal learning rate with multiplicative increment and smoothing with exponential weighted average and bias correction and the visualization of this log can be obtained through calling plot() method.
from pytorch_lr_tuner import LearningRateFinder
ESTIMATOR_CONFIG = {'input_shape': 21, 'output_shape': 1, 'hidden_units': [32, 64, 16]}
binary_crossentropy = nn.BCELoss()
lr_finder = LearningRateFinder(estimator=VanillaNet, config=ESTIMATOR_CONFIG, optimizer='sgd', criterion=binary_crossentropy, train_set=train_set, val_set=val_set)
lr_finder.fit()
lr_finder.plot()
Output:
Here, the learning rate with steepest gradient in loss can be inferred as an optimal one for this specific architecture.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pytorch_lr_tuner-0.0.2.tar.gz.
File metadata
- Download URL: pytorch_lr_tuner-0.0.2.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.7.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4c93c44f3d7c30751ce6ab137ada059b3397c937cc704217907f066909608843
|
|
| MD5 |
b6d57b13248bff719b4080d476a40d35
|
|
| BLAKE2b-256 |
cc5104d5212dd32b8df1f089f6a2994c9ed8ea8b0b3329a2744fd25f899e3b18
|
File details
Details for the file pytorch_lr_tuner-0.0.2-py3-none-any.whl.
File metadata
- Download URL: pytorch_lr_tuner-0.0.2-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.7.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
88f5b2a9de62db880fbb7639b70e92b62e613c2b78c82fd657018a4038eee25e
|
|
| MD5 |
994eaa8dcb901123fd7b5078525af474
|
|
| BLAKE2b-256 |
71ce2681e7e3247fe362118a9d589f1d9fb13b18abaa358c746b81b72878dd7f
|