Skip to content

Commit 2cf6fb8

Browse files
committed
SAC target entropy was being mulitplied by -1 but shouldnt ahve been
1 parent 9cf68ff commit 2cf6fb8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

agents/actor_critic_agents/SAC_Discrete.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ def __init__(self, config):
3636
lr=self.hyperparameters["Actor"]["learning_rate"])
3737
self.automatic_entropy_tuning = self.hyperparameters["automatically_tune_entropy_hyperparameter"]
3838
if self.automatic_entropy_tuning:
39-
self.target_entropy = - self.environment.unwrapped.action_space.n / 4.0 # heuristic value from the paper
39+
# we set the max possible entropy as the target entropy
40+
self.target_entropy = self.action_size * (1.0 / self.action_size) * np.log((1.0 / self.action_size))
4041
self.log_alpha = torch.zeros(1, requires_grad=True, device=self.device)
4142
self.alpha = self.log_alpha.exp()
4243
self.alpha_optim = Adam([self.log_alpha], lr=self.hyperparameters["Actor"]["learning_rate"])

0 commit comments

Comments
 (0)