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

Feat/add json logger #46

Merged
merged 13 commits into from
Feb 23, 2024
Merged

Feat/add json logger #46

merged 13 commits into from
Feb 23, 2024

Conversation

RuanJohn
Copy link
Collaborator

What?

Add a json logger to marl-eval to enable easy logging according to the protocol in the correct json format.

@RuanJohn RuanJohn self-assigned this Feb 23, 2024
@RuanJohn RuanJohn requested a review from sash-a February 23, 2024 11:35
Copy link
Collaborator

@sash-a sash-a left a comment

Choose a reason for hiding this comment

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

Looking great Ruan pretty much entirely just docstring changes.

The big thing to clarify is evaluation_step, we want to make it clear that it's not the number of evaluation timesteps.

marl_eval/json_tools/json_logger.py Outdated Show resolved Hide resolved
marl_eval/json_tools/json_logger.py Outdated Show resolved Hide resolved
marl_eval/json_tools/json_logger.py Outdated Show resolved Hide resolved
marl_eval/json_tools/json_logger.py Outdated Show resolved Hide resolved
environment_name: str,
seed: int,
):
"""Initialises the JsonWriter and creates the file if it doesn't exist."""
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
"""Initialises the JsonWriter and creates the file if it doesn't exist."""
"""Initialises the JsonLogger and create the file if it doesn't exist."""

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Wrote it slightly differently to your suggestion.

marl_eval/json_tools/json_logger.py Outdated Show resolved Hide resolved
marl_eval/json_tools/json_logger.py Outdated Show resolved Hide resolved
marl_eval/json_tools/json_logger.py Outdated Show resolved Hide resolved
marl_eval/json_tools/json_logger.py Outdated Show resolved Hide resolved
self.run_data[step_str] = step_metrics

with open(self.file_path, "w") as f:
json.dump(self.data, f, indent=4)
Copy link
Collaborator

Choose a reason for hiding this comment

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

if we reduced the indent to 2 here it would save quite a lot of space 🤔

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

True. We've just used 4 as a default in the past.

RuanJohn and others added 9 commits February 23, 2024 14:07
Co-authored-by: Sasha <reallysasha@gmail.com>
Co-authored-by: Sasha <reallysasha@gmail.com>
Co-authored-by: Sasha <reallysasha@gmail.com>
Co-authored-by: Sasha <reallysasha@gmail.com>
Co-authored-by: Sasha <reallysasha@gmail.com>
Co-authored-by: Sasha <reallysasha@gmail.com>
Co-authored-by: Sasha <reallysasha@gmail.com>
Co-authored-by: Sasha <reallysasha@gmail.com>
sash-a
sash-a previously approved these changes Feb 23, 2024
Copy link
Collaborator

@sash-a sash-a left a comment

Choose a reason for hiding this comment

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

Tiny thing, but approving anyways, feel free to make this change and then merge (changing indent level is up to you) 😄

marl_eval/json_tools/json_logger.py Outdated Show resolved Hide resolved
Co-authored-by: Sasha <reallysasha@gmail.com>
@RuanJohn RuanJohn merged commit ce80357 into main Feb 23, 2024
3 checks passed
@RuanJohn RuanJohn deleted the feat/add-json-logger branch February 23, 2024 13:42
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.

2 participants