Eclectic-Sheep / sheeprl

Distributed Reinforcement Learning accelerated by Lightning Fabric
https://eclecticsheep.ai
Apache License 2.0
274 stars 26 forks source link

Evaluation torch 2.0 #219

Closed michele-milesi closed 4 months ago

michele-milesi commented 4 months ago

With torch 2.0 it is not possible to call the torch.no_grad() in this way. This throws an error when trying to evaluate the agent with disable_grads=True. (https://pytorch.org/docs/2.0/generated/torch.no_grad.html?highlight=no_grad#torch.no_grad).

https://github.com/Eclectic-Sheep/sheeprl/blob/0639e16e68f0f56391a19f62485a5e4f78014fd5/sheeprl/cli.py#L226

This is allowed from torch 2.1 onwards (https://pytorch.org/docs/2.1/generated/torch.no_grad.html#no-grad).

cc: @belerico