Open moonblue333 opened 5 years ago
Thanks.
@yuntao-ma for index in BatchSampler(SubsetRandomSampler(range(self.buffer_capacity)), self.batch_size, True):
Why can I train with this code to only get nan actions
I get nan actions too
I change the code to :
for index in BatchSampler(SubsetRandomSampler(range(self.buffer_capacity)), self.batch_size, True):
but there still exists a bug:
Traceback (most recent call last): File "E:/AAAFor_PHD/UUV_SCI_Modif/UUV_obs_env/PPO2/Demo/PPO_demo.py", line 195, in <module> main() File "E:/AAAFor_PHD/UUV_SCI_Modif/UUV_obs_env/PPO2/Demo/PPO_demo.py", line 175, in main next_state, reward, done, info = env.step(action) File "F:\Anaconda\envs\Obstacle_Avoid\lib\site-packages\gym\envs\classic_control\pendulum.py", line 49, in step u = np.clip(u, -self.max_torque, self.max_torque)[0] IndexError: invalid index to scalar variable.
Transition = namedtuple('Transition',['state', 'aciton', 'reward', 'a_log_prob', 'next_state']) 'aciton' should be 'action'
I change the code to :
for index in BatchSampler(SubsetRandomSampler(range(self.buffer_capacity)), self.batch_size, True):
but there still exists a bug:Traceback (most recent call last): File "E:/AAAFor_PHD/UUV_SCI_Modif/UUV_obs_env/PPO2/Demo/PPO_demo.py", line 195, in <module> main() File "E:/AAAFor_PHD/UUV_SCI_Modif/UUV_obs_env/PPO2/Demo/PPO_demo.py", line 175, in main next_state, reward, done, info = env.step(action) File "F:\Anaconda\envs\Obstacle_Avoid\lib\site-packages\gym\envs\classic_control\pendulum.py", line 49, in step u = np.clip(u, -self.max_torque, self.max_torque)[0] IndexError: invalid index to scalar variable.
你好,我遇到了相同的报错,请问你后来解决了吗,谢谢
1) counter
2) for index in BatchSampler(SubsetRandomSampler(range(self.buffer_capacity), self.batch_size, True)):