Skip to content

Commit

Permalink
working with the new setup
Browse files Browse the repository at this point in the history
  • Loading branch information
manila95 committed Nov 16, 2023
1 parent a03db8d commit 787f088
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cleanrl/ddpg_continuous_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ def convert_dict_to_tensor(data, device):
np.random.seed(args.seed)
torch.manual_seed(args.seed)
torch.backends.cudnn.deterministic = args.torch_deterministic

torch.set_num_threads(4)
device = torch.device("cuda" if torch.cuda.is_available() and args.cuda else "cpu")

# env setup
Expand Down Expand Up @@ -467,9 +467,9 @@ def convert_dict_to_tensor(data, device):
success_rate.append(int(infos[0]["is_success"]))
score.append(info["episode"]['r'])
if args.fine_tune_risk != "None":
print(f"global_step={global_step}, episodic_return={info['episode']['r']}, Replay buffer size = {len(risk_rb)}, Total cost={total_cost}")
print(f"global_step={global_step}, episodic_return={info['episode']['r']}, Replay buffer size = {len(risk_rb)}, Total cost={total_cost}, Success Rate={np.mean(success_rate[-100:])}")
else:
print(f"global_step={global_step}, episodic_return={info['episode']['r']}, Ep Cost = {info['cum_cost']}")
print(f"global_step={global_step}, episodic_return={info['episode']['r']}, Ep Cost = {info['cost']}, Success Rate={np.mean(success_rate[-100:])}")
writer.add_scalar("charts/episodic_return", info["episode"]["r"], global_step)
writer.add_scalar("charts/episodic_length", info["episode"]["l"], global_step)
writer.add_scalar("charts/Total Success", num_successes, global_step)
Expand Down

0 comments on commit 787f088

Please sign in to comment.