-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Prefilter graphs in the uploader #3497
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
Conversation
|
|
||
|
|
||
| def migrate_event(event): | ||
| def migrate_event(event, experimental_filter_graph=False): |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
tensorboard/dataclass_compat_test.py
Outdated
|
|
||
| def test_graph_def_experimental_filter_graph(self): | ||
| # Create a `GraphDef` and write it to disk as an event. | ||
| logdir = self.get_temp_dir() |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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!
caisq
left a comment
There was a problem hiding this 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.
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).
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.
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).
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.
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).
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.