Skip to content

Commit

Permalink
Hotfix for #331 (#342)
Browse files Browse the repository at this point in the history
  • Loading branch information
vwxyzjn committed Jan 5, 2023
1 parent a90742a commit 94a44b5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cleanrl/rpo_continuous_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,12 @@ def get_action_and_value(self, x, action=None):
probs = Normal(action_mean, action_std)
if action is None:
action = probs.sample()
else: # new to RPO
else: # new to RPO
# sample again to add stochasticity to the policy
z = torch.FloatTensor(action_mean.shape).uniform_(-self.rpo_alpha, self.rpo_alpha)
action_mean = action_mean + z
probs = Normal(action_mean, action_std)

return action, probs.log_prob(action).sum(1), probs.entropy().sum(1), self.critic(x)


Expand Down
10 changes: 10 additions & 0 deletions tests/test_mujoco.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,13 @@ def test_mujoco():
shell=True,
check=True,
)
subprocess.run(
"python cleanrl/rpo_continuous_action.py --env-id Hopper-v4 --num-envs 1 --num-steps 64 --total-timesteps 128",
shell=True,
check=True,
)
subprocess.run(
"python cleanrl/rpo_continuous_action.py --env-id dm_control/cartpole-balance-v0 --num-envs 1 --num-steps 64 --total-timesteps 128",
shell=True,
check=True,
)

1 comment on commit 94a44b5

@vercel
Copy link

@vercel vercel bot commented on 94a44b5 Jan 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

cleanrl – ./

cleanrl-git-master-vwxyzjn.vercel.app
cleanrl-vwxyzjn.vercel.app
docs.cleanrl.dev
cleanrl.vercel.app

Please sign in to comment.