Warmup Scheduler Pytorch
Description
A Warmup Scheduler in Pytorch to make the learning rate change at the beginning of training for warmup.
Install
Notice: need to install pytorch>=1.1.0 manually.
The official website is PyTorch
Then install as follows:
pip install warmup_scheduler_pytorch
Usage
Detail to see GitHub example.py file.
import torch
from torch.optim import SGD # example
from torch.optim.lr_scheduler import CosineAnnealingLR # example
from warmup_scheduler_pytorch import WarmUpScheduler
model = Model()
optimizer = SGD(model.parameters(), lr=0.1)
lr_scheduler = CosineAnnealingLR(optimizer, T_max=100, eta_min=0.01)
data_loader = torch.utils.data.DataLoader(...)
warmup_scheduler = WarmUpScheduler(optimizer, lr_scheduler,
len_loader=len(data_loader),
warmup_steps=100,
warmup_start_lr=0.01,
warmup_mode='linear')
epochs = 100
for epoch in range(epochs):
for batch_data in data_loader:
output = model(...)
# loss = loss_fn(output, ...)
# loss.backward()
optimizer.step()
optimizer.zero_grad()
warmup_scheduler.step()
# lr_scheduler.step() is no longer needed
Metadata
Release files for warmup-scheduler-pytorch 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| warmup_scheduler_pytorch-0.1.2.tar.gz | 5.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| warmup_scheduler_pytorch-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.9 kB
Release files / warmup_scheduler_pytorch-0.1.2.tar.gz
| Download URL | warmup_scheduler_pytorch-0.1.2.tar.gz |
|---|---|
| Size | 5.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b3e67db7db952b3cb38801528a4c76107fb57143b29cf0c8e1aeef2561b1b31f
|
|
BLAKE2b-256 checksum How to use checksums |
58fe514711c5f50d8bb7324f6177eb24fb785a071abd7d986b1cd97c46930b8f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.9.7
|
Release files / warmup_scheduler_pytorch-0.1.2-py3-none-any.whl
| Download URL | warmup_scheduler_pytorch-0.1.2-py3-none-any.whl |
|---|---|
| Size | 5.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bdfb411fcd46d1da69cbc1634ac55c9292b13230600cb8ca8b7dfe1377647553
|
|
BLAKE2b-256 checksum How to use checksums |
af0a640dfb2fbddeaae89d8d7dd84307b75be7fe4dd668844c4f01a518e6cc4c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.9.7
|