Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Tensorboard logging not logging every log_interval timesteps #725

Closed
3 tasks done
YannBerthelot opened this issue Jan 18, 2022 · 10 comments · Fixed by #1325
Closed
3 tasks done

[Bug] Tensorboard logging not logging every log_interval timesteps #725

YannBerthelot opened this issue Jan 18, 2022 · 10 comments · Fixed by #1325
Labels
bug Something isn't working documentation Improvements or additions to documentation good first issue Good for newcomers

Comments

@YannBerthelot
Copy link

🐛 Bug

The documentation of DQN agent (https://stable-baselines3.readthedocs.io/en/master/modules/dqn.html) specifies that log_interval parameter is "The number of timesteps before logging". However, when set to 1 (or any other value) the logging is not made at that pace but is instead made every log_interval episode (and not timesteps). In the example below this is made every 200 timesteps.

To Reproduce

from stable_baselines3 import DQN

env = gym.make("MountainCar-v0")
model = DQN("MlpPolicy", env,tensorboard_log="logs")
model.learn(total_timesteps=2000, log_interval=1)

Expected behavior

I would have expected to see the logging every timestep and not every episode. Either the behavior should be switched (but logging every n episode is useful too ...) or the doc should be updated.

### System Info

OS: Linux-5.4.144+-x86_64-with-Ubuntu-18.04-bionic #1 SMP Tue Dec 7 09:58:10 PST 2021
Python: 3.7.12
Stable-Baselines3: 1.3.0
PyTorch: 1.10.0+cu111
GPU Enabled: False
Numpy: 1.19.5
Gym: 0.17.3

Checklist

  • I have checked that there is no similar issue in the repo (required)
  • I have read the documentation (required)
  • I have provided a minimal working example to reproduce the bug (required)
@YannBerthelot YannBerthelot added the bug Something isn't working label Jan 18, 2022
@Miffyli Miffyli added documentation Improvements or additions to documentation good first issue Good for newcomers labels Jan 18, 2022
@Miffyli
Copy link
Collaborator

Miffyli commented Jan 18, 2022

Thanks for reporting this! As per Discord chats, we should update the documentation to indeed reflect this behaviour (potentially same for other off-policy algos as well). I can try to fix this quickly, but if you want to get some github experience we would love to accept a PR from you that fixes this :)

@m1kol
Copy link

m1kol commented Jul 14, 2022

Yeah, the same experience with the DDPG algorithm on the Cartpole environment. And not only with TensorBoard, but logging in general. I used HumanOutputFormat and MLflowCustomFormat, provided in the documentation.

@theSquaredError
Copy link
Contributor

I want to solve this issue as my first open-source contribution. Please help me with further instructions.

@qgallouedec
Copy link
Collaborator

Hi @theSquaredError, I would be happy to help you with your first open-source contribution. I advise you to follow the step described in https://github.com/DLR-RM/stable-baselines3/blob/master/CONTRIBUTING.md. Don't hesitate to contact me if necessary!

@theSquaredError
Copy link
Contributor

Hi @qgallouedec, I can understand the issue here. what should i try for here, adding a new arguement for logging for each time interval. Can you tell me

@qgallouedec
Copy link
Collaborator

This one is just about updating the documentation, from "log every n timeteps" to "log every n episodes".

@theSquaredError
Copy link
Contributor

Okay thank you very much i will do that

@theSquaredError
Copy link
Contributor

I have corrected that statement, but I cannot push it. It says
remote: Permission to DLR-RM/stable-baselines3.git denied to theSquaredError.
fatal: unable to access 'https://github.com/DLR-RM/stable-baselines3.git/': The requested URL returned error: 403

@qgallouedec
Copy link
Collaborator

This is because you are trying to push to the master branch, which is protected. Here is a step-by-step process you can follow https://github.com/firstcontributions/first-contributions.

@theSquaredError
Copy link
Contributor

Hi @qgallouedec , I have updated the doc and submitted a pull request. Can you check once please

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants