Denys88 / rl_games

RL implementations
MIT License
800 stars 135 forks source link

Fix SAC with input normalization #291

Closed llinauer closed 2 weeks ago

llinauer commented 2 weeks ago

Atm, SAC does not work when giving normalize_input in the config.yml I propose an easy fix:

  1. In sac_agent.py, check if the self.normalize_input attribute is set. If yes, include the weights of the running_mean_std in the stat in get_weights method

  2. In players.py, get self.normalize_input from the config and apply self.model.norm_obs to the observation in get_action If normalize_input is False, then self.model.norm_obs will just be the Identity. If it is True, then it will apply the running mean to the observation

Denys88 commented 2 weeks ago

Thanks! Looks good.