Adam Optimizer Config
popinn.AdamConfig
¤
Configuration for an Adam optimization phase.
Source code in src/popinn/train.py
__init__(lr=0.001, num_epochs=1000, log_every=500, b1=0.9, b2=0.999, eps=1e-08)
¤
Optimizer is optax.adam.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lr
|
float | optax.Schedule
|
Constant learning rate, or an optax
schedule mapping step count to learning rate. Passed straight to
optax.adam. When using a step-based schedule (e.g. cosine decay),
its decay horizon should generally match |
0.001
|
num_epochs
|
int
|
Number of optimization steps in this phase. |
1000
|
log_every
|
int
|
Print a log line every this many steps. |
500
|
b1
|
float
|
Adam's first-moment decay rate. |
0.9
|
b2
|
float
|
Adam's second-moment decay rate. |
0.999
|
eps
|
float
|
Adam's epsilon for numerical stability. |
1e-08
|
popinn.warmup_cosine(peak_lr, num_epochs, init_lr=1e-05, warmup_steps=500)
¤
Convenience wrapper for optax.warmup_cosine_decay_schedule.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
peak_lr
|
float
|
peak learning rate reached at the end of warmup. |
required |
num_epochs
|
int
|
total steps; the cosine decay spans this horizon. |
required |
init_lr
|
float
|
learning rate at step 0. |
1e-05
|
warmup_steps
|
int
|
number of steps spent ramping up to peak_lr. |
500
|
Returns:
| Type | Description |
|---|---|
optax.Schedule
|
a callable step -> learning rate. |
Raises:
| Type | Description |
|---|---|
ValueError
|
if warmup_steps >= num_epochs (no steps left to decay over). optax's decay span is num_epochs - warmup_steps, which must be positive. |