# # import from source
git clone https://github.com/zyushun/Adam-mini
cd Adam-mini
pip install -e .
# Then use Adam-mini optimizer as follows
from adam_mini import Adam_mini
optimizer = Adam_mini(
named_parameters = model.named_parameters(),
lr = lr,
betas = (beta1,beta2),
eps = eps,
weight_decay = weight_decay,
model_sharding = True,
dim = model_config.dim,
n_heads = model_config.n_heads,
n_kv_heads = model_config.n_kv_heads,
)
# all the hyperparameters, including learning rate (lr), weight_decay, beta1, beta2, eps, its recommend using the same values as for AdamW