automl icon indicating copy to clipboard operation
automl copied to clipboard

how to train model by lion optimizer with fp16?

Open Geek-lixiang opened this issue 1 year ago • 1 comments

It says "Additional, Lion still requires momentum tracking in bfloat16, which can be expensive for training giant models. One potential solution is to factorize the momentum to save memory.", how to complete the "momentum tracking"? Thank you very much!

Geek-lixiang avatar Apr 17 '23 03:04 Geek-lixiang

For momentum tracking with bfloat16, you can just cast the type of momentum into bfloat16, see the example here: https://github.com/deepmind/optax/blob/master/optax/_src/transform.py#L461.

xiangning-chen avatar Aug 09 '23 23:08 xiangning-chen