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

Support new-style audio summaries #345

Merged
merged 1 commit into from
Aug 15, 2017

Conversation

wchargin
Copy link
Contributor

Summary:
This commit adds support for new-style audio summaries to the plugin
frontend and backend.

Here is a screenshot of the resulting dashboard:
Screenshot

This change is fully compatible with the old data format.

Test Plan:
Run bazel run //tensorboard/plugins/audio:audio_demo to get data
using new-style audio summaries. Also grab some old-style audio
summaries, perhaps by running the version of that target that appeared
before this commit (and changing the logdir to avoid writing into the
same directory). Launch a TensorBoard with a logdir enclosing all of
this data, and verify that it all renders correctly.

When running bazel test //tensorboard/..., be aware that this diff
contains a particularly large number of uses of tf.compat.as_bytes and
friends. Thus, it is wise to run this test command in both py2 and py3
virtualenvs.

wchargin-branch: new-style-audio-frontend


FLAGS = tf.flags.FLAGS

tf.flags.DEFINE_string('logdir', '/tmp/audio_demo',
'Directory into which to write TensorBoard data.')

tf.flags.DEFINE_integer('steps', 500,
tf.flags.DEFINE_integer('steps', 50,
Copy link
Contributor Author

@wchargin wchargin Aug 11, 2017

Choose a reason for hiding this comment

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

(Note: I made this change because it cuts down the output from 617.8 MB to "only" 79.6 MB, not because of anything to do with the new summaries.)

Copy link
Member

Choose a reason for hiding this comment

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

Sounds worth it to me. Maybe note in PR description.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure.

@wchargin wchargin force-pushed the wchargin-new-style-audio-frontend branch from 2c31866 to 7222873 Compare August 11, 2017 22:41
@wchargin wchargin force-pushed the wchargin-tensor-audio-summary branch from 5dcdd53 to b9f711c Compare August 11, 2017 22:45
@wchargin wchargin force-pushed the wchargin-new-style-audio-frontend branch from 7222873 to 8ef46dc Compare August 11, 2017 22:45
Copy link
Member

@chihuahua chihuahua left a comment

Choose a reason for hiding this comment

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

Looking forward to all the summaries using SummaryMetadata! Almost there.

@@ -41,12 +41,12 @@
from tensorboard.backend.event_processing import event_multiplexer
from tensorboard.plugins import base_plugin
from tensorboard.plugins.core import core_plugin
from tensorboard.plugins.audio import metadata as audio_metadata
Copy link
Member

Choose a reason for hiding this comment

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

Nit: I think audio comes before core.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

After deep self-reflection, I think so, too. thanks :-)

},
_hasMultipleSamples: {
type: Boolean,
computed: "_computeHasMultipleSamples(ofSamples)",
Copy link
Member

Choose a reason for hiding this comment

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

Nit: Maybe numberOfSamples?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's not clear to me what you're suggesting. We can't change ofSamples to numberOfSamples on this line (this is an argument name, not a parameter name); do you want to rename the property entirely?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah - maybe renaming the property to numberOfSamples is more clear?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay. It introduces a dissimilarity between this and the image dashboard, but that's not the end of the world.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(I'm using totalSamples because with numberOfSamples one is more likely to incorrectly infer that a particular card has multiple samples; using totalSamples clarifies that the aggregation is done at a higher level than the individual cards.)

Copy link
Member

Choose a reason for hiding this comment

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

Sounds good.


FLAGS = tf.flags.FLAGS

tf.flags.DEFINE_string('logdir', '/tmp/audio_demo',
'Directory into which to write TensorBoard data.')

tf.flags.DEFINE_integer('steps', 500,
tf.flags.DEFINE_integer('steps', 50,
Copy link
Member

Choose a reason for hiding this comment

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

Sounds worth it to me. Maybe note in PR description.

@wchargin
Copy link
Contributor Author

Looking forward to all the summaries using SummaryMetadata! Almost there.

I've been excited to save the easiest for last—one scalar.summary module coming up. :-)

@wchargin wchargin force-pushed the wchargin-new-style-audio-frontend branch from 8ef46dc to 225393f Compare August 12, 2017 01:53
@wchargin wchargin force-pushed the wchargin-tensor-audio-summary branch from b9f711c to 8e833ab Compare August 14, 2017 22:11
@wchargin wchargin force-pushed the wchargin-new-style-audio-frontend branch from 225393f to 5aee0dc Compare August 14, 2017 23:59
@wchargin wchargin changed the base branch from wchargin-tensor-audio-summary to master August 15, 2017 18:42
Summary:
This commit adds support for new-style audio summaries to the plugin
frontend and backend.

Here is a screenshot of the resulting dashboard:
![Screenshot](https://user-images.githubusercontent.com/4317806/29231118-d1ce0a44-7e9a-11e7-8029-0ffff6ab44de.png)

This change is fully compatible with the old data format.

While I was editing the demo, I changed its step count from 500 to 50.
Because we encode into WAV (ugh), the old demo was generating 617.8 MB
of data. It now generates “only” 79.6 MB. (This change has nothing to do
with the actual new summaries.)

Test Plan:
Run `bazel run //tensorboard/plugins/audio:audio_demo` to get data
using new-style audio summaries. Also grab some old-style audio
summaries, perhaps by running the version of that target that appeared
before this commit (and changing the logdir to avoid writing into the
same directory). Launch a TensorBoard with a logdir enclosing all of
this data, and verify that it all renders correctly.

When running `bazel test //tensorboard/...`, be aware that this diff
contains a particularly large number of uses of `tf.compat.as_bytes` and
friends. Thus, it is wise to run this test command in both py2 and py3
virtualenvs.

wchargin-branch: new-style-audio-frontend
@wchargin wchargin force-pushed the wchargin-new-style-audio-frontend branch from 5aee0dc to 8ffd715 Compare August 15, 2017 18:43
@wchargin wchargin merged commit 8e5c969 into master Aug 15, 2017
@wchargin wchargin deleted the wchargin-new-style-audio-frontend branch August 15, 2017 20:07
wchargin added a commit that referenced this pull request Jul 30, 2019
Summary:
This was a relic of a piecewise migration from the `event_accumulator`’s
old form to its current `plugin_event_accumulator` form. (See #345 for
an example of one of the intermediate states.) Now totally superfluous,
it incurs needless cognitive and CPU overhead, as the `getattr` blocks
standard optimizations.

Test Plan:
All tests pass, and TensorBoard can still load the standard demo data.

wchargin-branch: eliminate-metaprogramming
wchargin added a commit that referenced this pull request Jul 30, 2019
Summary:
This was a relic of a piecewise migration from the `event_accumulator`’s
old form to its current `plugin_event_accumulator` form. (See #345 for
an example of one of the intermediate states.) Now totally superfluous,
it incurs needless cognitive and CPU overhead, as the `getattr` blocks
standard optimizations.

Test Plan:
All tests pass, and TensorBoard can still load the standard demo data.

wchargin-branch: eliminate-metaprogramming
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