Denys88/rl_games

AttributeError: 'dict' object has no attribute 'clone' in SAC algorithm

Closed this issue · 2 comments

When I used the SAC algorithm with rl-games==1.6.1, the following error occurred

  File "/home/zhc/.local/share/ov/pkg/isaac_sim-2022.2.1/kit/python/lib/python3.7/site-packages/rl_games/algos_torch/sac_agent.py", line 497, in play_steps
    self.obs = next_obs.clone()
AttributeError: 'dict' object has no attribute 'clone'

Check the source code of the error section

            next_obs, rewards, dones, infos = self.env_step(action)
           
           # some  code
           
            if isinstance(next_obs, dict):    
                next_obs_processed = next_obs['obs']

            self.obs = next_obs.clone()

The next_obs returned by self.env_step(action) must be a dict after being packaged by the cast_obs function, but the error is reported when next_obs.clone() is called later.

hi, @scxzhchacker did you solve your problem?

Hi @scxzhchacker I will push the fix later today.