rlworkgroup / garage

A toolkit for reproducible reinforcement learning research.
MIT License
1.84k stars 309 forks source link

set_gpu_mode problem #2251

Closed TungWg closed 3 years ago

TungWg commented 3 years ago

Hi, everyone:

I want to train an example maml_trpo_metaworld_ml10.py(pytorch) on CUDA, so I added some codes:

from garage.torch import set_gpu_mode

if torch.cuda.is_available(): set_gpu_mode(True) else: set_gpu_mode(False) algo.to()

but it seems that the program cannot be trained on CUDA. Traceback: AttributerError: 'MAMLTRPO' object has no attribute 'to'. I've noticed that there are a lot of algorithms in garage have similar problems. How to resolve this problem, could you help? Thanks!

avnishn commented 3 years ago

Thanks for checking out garage and metaworld!

At the moment, MAML doesn't support training on gpu, because it would actually cause training to be slower, than if you were to instead train it on CPU.

The MAML policy is so small in the number of weights that it can be trained with, that it wouldn't make sense to train it on a gpu.

I don't foresee that we will plan on adding gpu support for it, but if you would like to implement a .to method for it, check out SAC, to get a better understanding of how to. It's only 3 or 4 lines of code.

TungWg commented 3 years ago

I'll do some experiments myself. Thank you for your reply.

At 2021-03-14 00:36:03, "Avnish Narayan" @.***> wrote:

Thanks for checking out garage and metaworld!

At the moment, MAML doesn't support training on gpu, because it would actually cause training to be slower, than if you were to instead train it on CPU.

The MAML policy is so small in the number of weights that it can be trained with, that it wouldn't make sense to train it on a gpu.

I don't foresee that we will plan on adding gpu support for it, but if you would like to implement a .to method for it, check out SAC, to get a better understanding of how to. It's only 3 or 4 lines of code.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.