Prefill dataset with 0 steps.
Simulating agent for 4995000 steps.
Found 5296820 model parameters.
Found 578412 actor parameters.
Found 413601 value parameters.
Start evaluation.
Training for 100 steps.
[5000] expl_amount 0.0 / model_grad_norm nan / value_grad_norm nan / actor_grad_norm nan / prior_ent nan / post_ent nan / image_loss inf / reward_loss nan / div nan / model_loss nan / value_loss nan / actor_loss nan / action_ent nan
Test episode of length 1000 with return 45.2.
Start collection.
Train episode of length 1000 with return 45.8.
Training for 100 steps.
[6000] expl_amount 0.3 / model_grad_norm nan / value_grad_norm nan / actor_grad_norm nan / prior_ent nan / post_ent nan / image_loss inf / reward_loss nan / div nan / model_loss nan / value_loss nan / actor_loss nan / action_ent nan / fps 0.7
Train episode of length 1000 with return 4.9.
Training for 100 steps.
[7000] expl_amount 0.3 / model_grad_norm nan / value_grad_norm nan / actor_grad_norm nan / prior_ent nan / post_ent nan / image_loss inf / reward_loss nan / div nan / model_loss nan / value_loss nan / actor_loss nan / action_ent nan / fps 21.3
Train episode of length 1000 with return 8.9.
Training for 100 steps.
[8000] expl_amount 0.3 / model_grad_norm nan / value_grad_norm nan / actor_grad_norm nan / prior_ent nan / post_ent nan / image_loss inf / reward_loss nan / div nan / model_loss nan / value_loss nan / actor_loss nan / action_ent nan / fps 22.3
Train episode of length 1000 with return 46.8.
Training for 100 steps.
[9000] expl_amount 0.3 / model_grad_norm nan / value_grad_norm 9.2 / actor_grad_norm 0.0 / prior_ent 35.6 / post_ent 52.0 / image_loss inf / reward_loss inf / div inf / model_loss inf / value_loss 1.2 / actor_loss -12.3 / action_ent inf / fps 28.4
Train episode of length 1000 with return 5.2.
...
[162000] expl_amount 0.3 / model_grad_norm nan / value_grad_norm nan / actor_grad_norm nan / prior_ent nan / post_ent nan / image_loss inf / reward_loss nan / div nan / model_loss nan / value_loss nan / actor_loss nan / action_ent nan / fps 20.6
Train episode of length 1000 with return 6.3.
Training for 100 steps.
[163000] expl_amount 0.3 / model_grad_norm nan / value_grad_norm nan / actor_grad_norm nan / prior_ent nan / post_ent nan / image_loss inf / reward_loss nan / div nan / model_loss nan / value_loss nan / actor_loss nan / action_ent nan / fps 20.9
Train episode of length 1000 with return 47.6.
Training for 100 steps.
[164000] expl_amount 0.3 / model_grad_norm nan / value_grad_norm nan / actor_grad_norm nan / prior_ent nan / post_ent nan / image_loss inf / reward_loss nan / div nan / model_loss nan / value_loss nan / actor_loss nan / action_ent nan / fps 20.6
Train episode of length 1000 with return 4.9.
Start evaluation.
Training for 100 steps.
[165000] expl_amount 0.3 / model_grad_norm nan / value_grad_norm nan / actor_grad_norm nan / prior_ent nan / post_ent nan / image_loss inf / reward_loss nan / div nan / model_loss nan / value_loss nan / actor_loss nan / action_ent nan / fps 20.8
WARNING:absl:Nan, Inf or huge value in CTRL at ACTUATOR 0. The simulation is unstable. Time = 0.0000.
Traceback (most recent call last):
File "/root/dreamer2/dreamer.py", line 468, in <module>
main(parser.parse_args())
File "/root/dreamer2/dreamer.py", line 448, in main
functools.partial(agent, training=False), test_envs, episodes=1)
File "/root/dreamer2/tools.py", line 124, in simulate
obs, _, done = zip(*[p()[:3] for p in promises])
File "/root/dreamer2/tools.py", line 124, in <listcomp>
obs, _, done = zip(*[p()[:3] for p in promises])
File "/root/dreamer2/wrappers.py", line 350, in step
obs, reward, done, info = self._env.step(action)
File "/root/dreamer2/wrappers.py", line 162, in step
obs, reward, done, info = self._env.step(action)
File "/root/dreamer2/wrappers.py", line 211, in step
obs, reward, done, info = self._env.step(action)
File "/root/dreamer2/wrappers.py", line 267, in step
return self._env.step(original)
File "/root/dreamer2/wrappers.py", line 239, in step
obs, reward, done, info = self._env.step(action)
File "/root/dreamer2/wrappers.py", line 45, in step
time_step = self._env.step(action)
File "/root/miniconda3/envs/dreamer/lib/python3.7/site-packages/dm_control/rl/control.py", line 106, in step
self._physics.step(self._n_sub_steps)
File "/root/miniconda3/envs/dreamer/lib/python3.7/site-packages/dm_control/mujoco/engine.py", line 176, in step
mujoco.mj_step(self.model.ptr, self.data.ptr, nstep)
File "/root/miniconda3/envs/dreamer/lib/python3.7/contextlib.py", line 119, in __exit__
next(self.gen)
File "/root/miniconda3/envs/dreamer/lib/python3.7/site-packages/dm_control/mujoco/engine.py", line 344, in check_invalid_state
raise _control.PhysicsError(message)
dm_control.rl.control.PhysicsError: Physics state is invalid. Warning(s) raised: mjWARN_BADCTRL
It seems that models were not well trained because of abnormal gradients. Specifically, paritial results of post, prior = self._dynamics.observe(embed, data['action']) are nan:
prior['deter']
Out[23]:
<tf.Tensor: shape=(25, 50, 200), dtype=float16, numpy=
array([[[ 0.00545, -0.0837 , -0.0209 , ..., 0.06793, -0.1763 ,
0.0151 ],
[ 1. , -1. , -0.0209 , ..., -1. , -1. ,
0.0151 ],
[-1. , -1. , -0.0209 , ..., -1. , 1. ,
0.0151 ],
...,
[ nan, nan, nan, ..., nan, nan,
nan],
[ nan, nan, nan, ..., nan, nan,
nan],
[ nan, nan, nan, ..., nan, nan,
nan]],
[[ 0.00545, -0.0837 , -0.0209 , ..., 0.06793, -0.1763 ,
0.0151 ],
[ 0.00545, -0.0837 , -0.0209 , ..., 0.06793, 1. ,
0.0151 ],
[ 0.00545, -0.0837 , -0.0209 , ..., -1. , 1. ,
0.0151 ],
...,
[ nan, nan, nan, ..., nan, nan,
nan],
[ nan, nan, nan, ..., nan, nan,
nan],
[ nan, nan, nan, ..., nan, nan,
nan]],
[[ 0.00545, -0.0837 , -0.0209 , ..., 0.06793, -0.1763 ,
0.0151 ],
[ 1. , -0.0837 , -0.0209 , ..., 0.06793, -0.1763 ,
0.0151 ],
[ 1. , -0.0837 , 1. , ..., 0.06793, -0.1763 ,
0.0151 ],
...,
[ nan, nan, nan, ..., nan, nan,
nan],
[ nan, nan, nan, ..., nan, nan,
nan],
[ nan, nan, nan, ..., nan, nan,
nan]],
...,
[[ 0.00545, -0.0837 , -0.0209 , ..., 0.06793, -0.1763 ,
0.0151 ],
[-1. , -0.0837 , -0.0209 , ..., 1. , -1. ,
-1. ],
[-1. , -1. , 1. , ..., 1. , 1. ,
-1. ],
...,
[ nan, nan, nan, ..., nan, nan,
nan],
[ nan, nan, nan, ..., nan, nan,
nan],
[ nan, nan, nan, ..., nan, nan,
nan]],
[[ 0.00545, -0.0837 , -0.0209 , ..., 0.06793, -0.1763 ,
0.0151 ],
[ 1. , -0.0837 , -1. , ..., 0.06793, 1. ,
0.0151 ],
[ 1. , -0.0837 , 1. , ..., 0.06793, 1. ,
0.0151 ],
...,
[ nan, nan, nan, ..., nan, nan,
nan],
[ nan, nan, nan, ..., nan, nan,
nan],
[ nan, nan, nan, ..., nan, nan,
nan]],
[[ 0.00545, -0.0837 , -0.0209 , ..., 0.06793, -0.1763 ,
0.0151 ],
[-1. , -0.0837 , -0.0209 , ..., 0.06793, 1. ,
0.0151 ],
[ 1. , -1. , -0.0209 , ..., 0.06793, 1. ,
0.0151 ],
...,
[ nan, nan, nan, ..., nan, nan,
nan],
[ nan, nan, nan, ..., nan, nan,
nan],
[ nan, nan, nan, ..., nan, nan,
nan]]], dtype=float16)>
There is no significant improvent after 0.98 million trainning steps, and both the model losses and gradients are not stable. Here are some intermediate results:
Here is my log of running
python -u /root/dreamer/dreamer.py --logdir /root/dreamer/logdir/dmc_walker_walk/dreamer/1 --task dmc_walker_walk:It seems that models were not well trained because of abnormal gradients. Specifically, paritial results of
post, prior = self._dynamics.observe(embed, data['action'])arenan:I tried to set the
config.precisionto be 32. Here is the log:There is no significant improvent after 0.98 million trainning steps, and both the model losses and gradients are not stable. Here are some intermediate results:
The python packages of my env are as follows: