learn2learn
learn2learn copied to clipboard
Warning with clone
E:\Anaconda\envs\RL\lib\site-packages\torch\nn\modules\module.py:385: UserWarning: The .grad attribute of a Tensor that is not a leaf Tensor is being accessed. Its .grad attribute won't be populated during autograd.backward(). If you indeed want the gradient for a non-leaf Tensor, use .retain_grad() on the non-leaf Tensor. If you access the non-leaf Tensor by mistake, make sure you access the leaf Tensor instead. See github.com/pytorch/pytorch/pull/30531 for more informations. if param.grad is not None:
I used learn2learn lib to finished the maml ppo algorithm. But when I changed my net from self.net = nn.Sequential(nn.Linear(self.input_dim, mid_dim), nn.ReLU(), nn.Linear(mid_dim, mid_dim), nn.ReLU(), nn.Linear(mid_dim, mid_dim), nn.ReLU(), nn.Linear(mid_dim, action_dim),
into self.gru = nn.GRU(self.input_dim, mid_dim, num_layers=2) self.net = nn.Sequential(nn.Linear(self.mid_dim, mid_dim), nn.ReLU(), nn.Linear(mid_dim, mid_dim), nn.ReLU(), # nn.Linear(mid_dim, mid_dim), nn.ReLU(), nn.Linear(mid_dim, action_dim), )
, the warning occurred.
And another problem is that if I set the adapt_step too large, my meta_policy after meta updating would output NAN.
I'll be appreciate if you can help me solve these problems.
Which version of learn2learn do you have installed? We should support RNNs (I had tested with LSTMs). If you could provide a colab reproducing the issue, I'll try to dig into it.
Closing since inactive.