openpi icon indicating copy to clipboard operation
openpi copied to clipboard

Question about grad accumulation

Open Tian-Nian opened this issue 11 months ago • 4 comments

hello,I want to finetune pi0_base on my machine,but i only have 48G GPU memory,if there any setting allow me use grad accumulation?

Tian-Nian avatar Feb 11 '25 08:02 Tian-Nian

I have found the FSDP setting,I will try it sooner~

Tian-Nian avatar Feb 11 '25 08:02 Tian-Nian

for using gradient accumulation, you can wrap the optimizer with optax.MultiSteps: https://optax.readthedocs.io/en/latest/api/optimizer_wrappers.html#optax.MultiSteps.

we didn't include in the release but i have tried myself personally but let me know if you run into issues.

more ref: https://optax.readthedocs.io/en/latest/_collections/examples/gradient_accumulation.html

haohuanw avatar Feb 12 '25 06:02 haohuanw

thanks for your help! I will try using multi gpu setting FSDP first

Tian-Nian avatar Feb 12 '25 11:02 Tian-Nian

We've decided to implement grad accumulation. Please stay tuned.

uzhilinsky avatar Feb 12 '25 23:02 uzhilinsky

We've decided to implement grad accumulation. Please stay tuned.

thanks for your reply! I'm really looking forward for the update!

Tian-Nian avatar Feb 14 '25 04:02 Tian-Nian