cosine-warmup-0.0.0
توضیحات
Cosine Annealing Linear Warmup
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | cosine-warmup-0.0.0 |
| نام | cosine-warmup |
| نسخه کتابخانه | 0.0.0 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Arturo Ghinassi |
| ایمیل نویسنده | ghinassiarturo8@gmail.com |
| آدرس صفحه اصلی | - |
| آدرس اینترنتی | https://pypi.org/project/cosine-warmup/ |
| مجوز | - |
# Cosine Annealing Scheduler with Linear Warmup
Implementation of a Cosine Annealing Scheduler with Linear Warmup and Restarts in PyTorch. \
It has support for multiple parameters groups and minimum target learning rates. \
Also works with the Lightning Modules!
# Installation
```pip install 'git+https://github.com/santurini/cosine-annealing-linear-warmup'```
# Usage
It is important to specify the parameters groups in the optimizer instantiation as the learning rates are directly inferred from the wrapped optimizer.
#### Example: Multiple groups
```
from cosine_warmup import CosineAnnealingLinearWarmup
optimizer = torch.optim.Adam([
{"params": first_group_params, "lr": 1e-3},
{"params": second_group_params, "lr": 1e-4},
]
)
scheduler = CosineAnnealingLinearWarmup(
optimizer = optimizer,
min_lrs = [ 1e-5, 1e-6 ],
first_cycle_steps = 1000,
warmup_steps = 500,
gamma = 0.9
)
# this is equivalent to
scheduler = CosineAnnealingLinearWarmup(
optimizer = optimizer,
min_lrs_pow = 2,
first_cycle_steps = 1000,
warmup_steps = 500,
gamma = 0.9
)
```
#### Example: Single groups
```
from cosine_linear_warmup import CosineAnnealingLinearWarmup
optimizer = torch.optim.Adam(model.parameters(), lr=1e-3)
scheduler = CosineAnnealingLinearWarmup(
optimizer = optimizer,
min_lrs = [ 1e-5 ],
first_cycle_steps = 1000,
warmup_steps = 500,
gamma = 0.9
)
# this is equivalent to
scheduler = CosineAnnealingLinearWarmup(
optimizer = optimizer,
min_lrs_pow = 2,
first_cycle_steps = 1000,
warmup_steps = 500,
gamma = 0.9
)
```
# Visual Example

نیازمندی
| مقدار | نام |
|---|---|
| >=1.7 | torch |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.8 | Python |
نحوه نصب
نصب پکیج whl cosine-warmup-0.0.0:
pip install cosine-warmup-0.0.0.whl
نصب پکیج tar.gz cosine-warmup-0.0.0:
pip install cosine-warmup-0.0.0.tar.gz