learnables / learn2learn

A PyTorch Library for Meta-learning Research
http://learn2learn.net
MIT License
2.59k stars 348 forks source link

Cuda out of Memory with function adapt #393

Closed Yi-Owl closed 1 year ago

Yi-Owl commented 1 year ago

The method of adapt in MAML will continously occupied the memory, thus result in Cuda out of Memory error with too many adapt using. allocate I've printed the memory allocated after every times cuda memory changing. How to solve the problem if I want to adapt with more adapt steps and more data ?

seba-1511 commented 1 year ago

Hello @Yi-Owl,

There's no solution if you want to back-propagate through the adaptation steps.

If you don't need to back-propagate, setting first_order=True in adapt() should do it. See the docs.