pythonloggingstable-baselines

Log frequency stable_baselines3


I am training a Reinforcement Learning agent using stable_baselines3.

Is there a way to edit the frequency of the logs (log the mean reward every 200 steps) ?

I found this parameter _log_freq but it's not working

class TensorboardCallback(BaseCallback):
    def __init__(self, verbose=0):
        super().__init__(verbose)
        self._log_freq = 100

    def _on_step(self) -> bool:
        #some code
        return True

Solution

  • It's the parameter log_interval in the learn() function

    model = A2C("CnnPolicy", env, verbose=1,tensorboard_log='./'+tmp_path, )
    model.learn(total_timesteps=int(N_STEP),callback=TensorboardCallback(),log_interval = 100)