Created
May 19, 2023 12:44
-
-
Save tudorjnu/730518856bc9a43c52635d2fa8e3f274 to your computer and use it in GitHub Desktop.
parses a tensorboard file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def parse_tensorboard_log(path: Path): | |
from tensorboard.backend.event_processing.event_accumulator import EventAccumulator | |
import pandas as pd | |
tag = 'rollout/ep_len_mean' | |
acc = EventAccumulator(path) | |
acc.Reload() | |
# check if the tag exists | |
if tag not in acc.Tags()['scalars']: | |
print("Tag not found") | |
return | |
df = pd.DataFrame(acc.Scalars(tag)) | |
df = df.drop(columns=['wall_time']).groupby('step').mean() | |
return df |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment