- [main]
- [distributed-baselines]
- [distributed-l2r] (formerly
l2r-benchmarks -> distributed-worker branch) - [sequential-l2r] (formerly
l2r-lab -> phoebe branch)
- Prepend
apt-get updatefor worker-pods' command - Replace
worker.pyandlearner.pywithdistributedworker.pyanddistributedserver.pyrespectively for worker-pods and learner-pod - Add
tensorboardXto the installation command for learner-pod
- Moved
distributedworker.pyanddistributedlearner.pyfrom./scripts/toroot ./src/config/schema.pymissing fields fromconfig_files/async_sac/agent.yaml./config_files/async_sac/agent.yamlupdate parameter nameactor_critic_cfg -> actor_critic_cfg_path- Added
state_dict(self)function inSACAgent.py - Remove
entity="learn2race"fromsrc/loggers/WanDBLogger.py - Added
wandb tensorboardX jsonpicklefor the pip install of the server and learner inl2r-distributed.yaml - Using the
load_model()from thel2r-benchmarks -> distributed-aicrowdinSACAgent.yaml
-
Remove
entity="learn2race"fromsrc/loggers/WanDBLogger.py -
Change the default action space from
self.action_space = Box(-1, 1, (4,))toself.action_space = Box(-1, 1, (self.actor_critic.action_dim,))insrc/agents/SACAgent.py -
Add
self.action_dim = action_dimtoclass ActorCritic(nn.Module)insrc/networks/critic.py, so that the above command can work -
Add the handling of action being a scalar in
select_action()insrc/agents/SACAgents.py
def select_action(self, obs):
...
a = self.actor_critic.act(obs.to(DEVICE), self.deterministic)
if a.shape == ():
# In case a in a scalar
a = np.array([a])
action_obj.action = a
...- Modifications in
src/networks/network_baselines.py
# SquashedGaussianMLPActor()
def forward(self, obs, deterministic=False, with_logprob=True):
net_out = self.net(obs)
mu = self.mu_layer(net_out)
log_std = self.log_std_layer(net_out)
log_std = torch.clamp(log_std, LOG_STD_MIN, LOG_STD_MAX)
std = torch.exp(log_std)
pi_distribution = Normal(mu, std)
if deterministic:
# Only used for evaluating policy at test time.
pi_action = mu
else:
pi_action = pi_distribution.rsample()
if with_logprob:
# Compute logprob from Gaussian, and then apply correction for Tanh squashing.
# NOTE: The correction formula is a little bit magic. To get an understanding
# of where it comes from, check out the original SAC paper (arXiv 1801.01290)
# and look in appendix C. This is a more numerically-stable equivalent to Eq 21.
# Try deriving it yourself as a (very difficult) exercise. :)
logp_pi = pi_distribution.log_prob(pi_action).sum(axis=-1)
logp_pi -= (2 * (np.log(2) - pi_action - F.softplus(-2 * pi_action))).sum(
axis=1
)
else:
logp_pi = None
pi_action = torch.tanh(pi_action)
pi_action = self.act_limit * pi_action
return pi_action, logp_pi- Add environment variable
AGENT_NAMEin both code and deployment YAML to configure which agent to run