Skip to content

Conversation

@davidsoergel
Copy link
Member

There is no point in uploading GraphDef data that won't be displayed anyway. In particular, the TensorBoard frontend filters out node attributes larger that 1024 bytes, since it has no good way to present those. So we may as well filter those out before upload to TensorBoard.dev, so as not to waste bandwidth, storage, and read-time processing.

@davidsoergel davidsoergel requested a review from caisq April 9, 2020 16:25


def migrate_event(event):
def migrate_event(event, experimental_filter_graph=False):
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add doc string for the new kwarg.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oops, done.

ValueError: If `large_attrs_key is None` while `limit_attr_size != None`.
ValueError: If `limit_attr_size` is defined, but <= 0.
"""
# TODO(@davidsoergel): detect whether a graph has been filtered already
Copy link
Contributor

Choose a reason for hiding this comment

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

To make this TODO item clearer, I believe you can say in addition: "if it is already filtered, return immediately".

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.


def test_graph_def_experimental_filter_graph(self):
# Create a `GraphDef` and write it to disk as an event.
logdir = self.get_temp_dir()
Copy link
Contributor

Choose a reason for hiding this comment

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

Question about testing strategy: is it really necessary to create a logdir and a writer? If your intention here is to simply test self._migrate_event() (and ultimately dataclass_compat.migrate_event()), you can just construct a Event, pass it to that method and check the result, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh good point. I had pasted that from the test above but here the logdir part is superfluous. (There too, maybe, but that's out of scope). Thanks!

@davidsoergel davidsoergel requested a review from caisq April 9, 2020 20:19
Copy link
Contributor

@caisq caisq left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for reducing the size of the uploaded graphs.

@davidsoergel davidsoergel changed the title Prefilter graphs in the uploader (stopgap proposal) Prefilter graphs in the uploader Apr 10, 2020
@davidsoergel davidsoergel merged commit 1397867 into master Apr 10, 2020
@davidsoergel davidsoergel deleted the prefilter-graphs branch April 10, 2020 12:43
davidsoergel added a commit that referenced this pull request Apr 10, 2020
Since #3497, we parse GraphDefs in dataclass_compat.py during upload. If a graph is corrupt, that parsing fails. Here we catch the resulting exception, issue a warning, and continue (omitting the graph).

This also updates tests to use valid GraphDefs where appropriate, as opposed to bytes(1024), which apparently produces inconsistent results with different proto parsers (e.g., OSS vs. Google internal).
bileschi pushed a commit to bileschi/tensorboard that referenced this pull request Apr 15, 2020
There is no point in uploading GraphDef data that won't be displayed anyway. In particular, the TensorBoard frontend filters out node attributes larger that 1024 bytes, since it has no good way to present those. So we may as well filter those out before upload to TensorBoard.dev, so as not to waste bandwidth, storage, and read-time processing.
bileschi pushed a commit to bileschi/tensorboard that referenced this pull request Apr 15, 2020
Since tensorflow#3497, we parse GraphDefs in dataclass_compat.py during upload. If a graph is corrupt, that parsing fails. Here we catch the resulting exception, issue a warning, and continue (omitting the graph).

This also updates tests to use valid GraphDefs where appropriate, as opposed to bytes(1024), which apparently produces inconsistent results with different proto parsers (e.g., OSS vs. Google internal).
bileschi pushed a commit that referenced this pull request Apr 15, 2020
There is no point in uploading GraphDef data that won't be displayed anyway. In particular, the TensorBoard frontend filters out node attributes larger that 1024 bytes, since it has no good way to present those. So we may as well filter those out before upload to TensorBoard.dev, so as not to waste bandwidth, storage, and read-time processing.
bileschi pushed a commit that referenced this pull request Apr 15, 2020
Since #3497, we parse GraphDefs in dataclass_compat.py during upload. If a graph is corrupt, that parsing fails. Here we catch the resulting exception, issue a warning, and continue (omitting the graph).

This also updates tests to use valid GraphDefs where appropriate, as opposed to bytes(1024), which apparently produces inconsistent results with different proto parsers (e.g., OSS vs. Google internal).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants