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

Support experiment tracking with W&B #213

Merged
merged 10 commits into from
Mar 4, 2022

Conversation

vwxyzjn
Copy link
Contributor

@vwxyzjn vwxyzjn commented Feb 28, 2022

Description

closes #212

Motivation and Context

  • I have raised an issue to propose this change (required for new features and bug fixes)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation (update in the documentation)

Checklist:

  • I've read the CONTRIBUTION guide (required)
  • I have updated the changelog accordingly (required).
  • My change requires a change to the documentation.
  • I have updated the tests accordingly (required for a bug fix or a new feature).
  • I have updated the documentation accordingly.
  • I have reformatted the code using make format (required)
  • I have checked the codestyle using make check-codestyle and make lint (required)
  • I have ensured make pytest and make type both pass. (required)

Note: we are using a maximum length of 127 characters per line

Copy link
Member

@araffin araffin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR =)
In fact, that was something I wanted to add at some point. Could you also document the use in the readme and update the changelog?

train.py Outdated Show resolved Hide resolved
train.py Outdated Show resolved Hide resolved
train.py Outdated Show resolved Hide resolved
Co-authored-by: Antonin RAFFIN <antonin.raffin@ensta.org>
@vwxyzjn
Copy link
Contributor Author

vwxyzjn commented Feb 28, 2022

Also a quick question, I would like to also log raw episodic return instead of the average one rollout/ep_rew_mean. What do you think is the best way to do it?

@araffin
Copy link
Member

araffin commented Feb 28, 2022

What do you think is the best way to do it?

There are two options:

  • use a callback that uses the infos dict to retrieve episodic returns (similar to how we compute rollout/ep_rew_mean)
  • read the csv files with a callback

in both cases, you need a callback and you need to be careful when using multiple envs.
For option 2, you could even flush the graph everytime if it's possible (would be the easiest but also more costly in computation time).

@vwxyzjn
Copy link
Contributor Author

vwxyzjn commented Feb 28, 2022

in both cases, you need a callback and you need to be careful when using multiple envs.

This is interesting. I guess for Mutil-agent envs, this can be quite tricky. how do you currently log it?

@araffin
Copy link
Member

araffin commented Feb 28, 2022

I guess for Mutil-agent envs, this can be quite tricky. how do you currently log it?

I tend to use an EvalCallback anyway, because the training performance is different from the true performance.
Otherwise, we just loop through the infos list (https://github.com/DLR-RM/stable-baselines3/blob/master/stable_baselines3/common/base_class.py#L459) and update the buffer.
For the monitor files, they are handled by each separately and contains the timestamps which allow to order them afterward.

@vwxyzjn
Copy link
Contributor Author

vwxyzjn commented Mar 3, 2022

Added the documentation. I tried playing with the callbacks but couldn't quite find a way to pass callback other than overwriting the yaml files... Perhaps the raw stats stuff should be put into a separate PR?

README.md Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
@araffin
Copy link
Member

araffin commented Mar 3, 2022

Perhaps the raw stats stuff should be put into a separate PR?

yes, please

train.py Outdated Show resolved Hide resolved
train.py Outdated Show resolved Hide resolved
Co-authored-by: Antonin RAFFIN <antonin.raffin@ensta.org>
train.py Outdated Show resolved Hide resolved
train.py Outdated Show resolved Hide resolved
train.py Show resolved Hide resolved
train.py Show resolved Hide resolved
Copy link
Member

@araffin araffin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor comments, otherwise LGTM =)

@araffin araffin merged commit 8e3744d into DLR-RM:master Mar 4, 2022
@vwxyzjn vwxyzjn deleted the track-experiments branch March 4, 2022 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[feature request] Support experiment tracking via W&B
2 participants