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

Fix error in tensorboard plotting #896

Merged
merged 1 commit into from
Dec 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion sbi/analysis/tensorboard_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,11 @@ def _get_event_data_from_log_dir(
# we inspect their argument signature. These events are named tuples
# that can be found here:
# https://github.com/tensorflow/tensorboard/blob/b84f3738032277894c6f3fd3e011f032a89d002c/tensorboard/backend/event_processing/event_accumulator.py#L37
# When looping over `inspect.getfullargspec()` there is also a `self`
# attribute.
_type = type(data[0])
for attribute in inspect.getfullargspec(_type).args:
if not attribute.startswith("_"):
if not attribute.startswith("_") and not attribute == "self":
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure when this happened but probably when tensorboard changed their event accumulator api from namedtuples to dataclass (which then causes the additional "self" attribute in the argspec). So this fix would do it! 👍
For reference, old event accumulator api https://github.com/tensorflow/tensorboard/blob/b84f3738032277894c6f3fd3e011f032a89d002c/tensorboard/backend/event_processing/event_accumulator.py#L37
and new api
https://github.com/tensorflow/tensorboard/blob/517a57e1c188f66006d201427e599b908465f5ba/tensorboard/backend/event_processing/event_accumulator.py#L43

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, nice, thanks for the references!

if attribute not in all_event_data[tag_type][tag]:
all_event_data[tag_type][tag][attribute] = []
for datapoint in data:
Expand Down
Loading