You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The SAC algorithm has been normal before. Recently, after reading the saved policy weight and optimizer, the first learning error is as follows. How can I solve it?
Epoch#1: 0%| | 23/57600 [00:02<1:37:11, 9.87it/s]
('If capturable=False, state_steps should not be CUDA tensors.',)
===========Traceback (mostrecentcalllast):
File"D:\Tony\Documents\yunpan\invest\2022\Quant\code\factor\myfactor.py", line684, inwrapperfunc(*args, **kw)
File"tianshou_if.py", line378, insac_with_il_ifresult=offpolicy_trainer(
File"D:\Anaconda3\lib\site-packages\tianshou\trainer\offpolicy.py", line129, inoffpolicy_trainerreturnOffpolicyTrainer(*args, **kwargs).run()
File"D:\Anaconda3\lib\site-packages\tianshou\trainer\base.py", line425, inrundeque(self, maxlen=0) # feed the entire iterator into a zero-length dequeFile"D:\Anaconda3\lib\site-packages\tianshou\trainer\base.py", line282, in__next__self.policy_update_fn(data, result)
File"D:\Anaconda3\lib\site-packages\tianshou\trainer\offpolicy.py", line118, inpolicy_update_fnlosses=self.policy.update(self.batch_size, self.train_collector.buffer)
File"D:\Anaconda3\lib\site-packages\tianshou\policy\base.py", line277, inupdateresult=self.learn(batch, **kwargs)
File"D:\Anaconda3\lib\site-packages\tianshou\policy\modelfree\sac.py", line149, inlearntd1, critic1_loss=self._mse_optimizer(
File"D:\Anaconda3\lib\site-packages\tianshou\policy\modelfree\ddpg.py", line158, in_mse_optimizeroptimizer.step()
File"D:\Anaconda3\lib\site-packages\torch\optim\optimizer.py", line109, inwrapperreturnfunc(*args, **kwargs)
File"D:\Anaconda3\lib\site-packages\torch\autograd\grad_mode.py", line27, indecorate_contextreturnfunc(*args, **kwargs)
File"D:\Anaconda3\lib\site-packages\torch\optim\adam.py", line157, instepadam(params_with_grad,
File"D:\Anaconda3\lib\site-packages\torch\optim\adam.py", line213, inadamfunc(params,
File"D:\Anaconda3\lib\site-packages\torch\optim\adam.py", line255, in_single_tensor_adamassertnotstep_t.is_cuda, "If capturable=False, state_steps should not be CUDA tensors."AssertionError: Ifcapturable=False, state_stepsshouldnotbeCUDAtensors.
The text was updated successfully, but these errors were encountered:
Hi, I am also facing the same issue when I try to load the checkpoint and resume model training on the latest pytorch (1.12).
It seems to be related with a newly introduced parameter (capturable) for the Adam and AdamW optimizers. Currently two workarounds:
forcing capturable = True after loading the checkpoint (as suggested above) optim.param_groups[0]['capturable'] = True . This seems to slow down the model training by approx. 10% (YMMV depending on the setup).
Reverting pytorch back to previous versions (I have been using 1.11.0).
I'm wondering whether enforcing capturable = True may incur unwanted side effects.
I'm also wondering about whether forcing captureable=True would have unwanted side effects. I will also return to torch1.11.
The
SAC
algorithm has been normal before. Recently, after reading the saved policy weight and optimizer, the first learning error is as follows. How can I solve it?The text was updated successfully, but these errors were encountered: