tensorboard icon indicating copy to clipboard operation
tensorboard copied to clipboard

Can't load >5 Audio summaries, Broken pipe error

Open teamdandelion opened this issue 9 years ago • 21 comments

Migrated from https://github.com/tensorflow/tensorflow/issues/8055.

There's a bunch more discussion on the original thread, plus some repro files from @lemonzi

Possibly related: https://github.com/tensorflow/tensorflow/issues/4207 Setup: OSX 10.10, TF nightly build of 2017-03-02 without GPU, Python 2.7.13. Affects both Chrome 56.0 and Safari 10.0. I think the official 1.0.0 release also had this issue.

My model logs relatively long audio summaries (~3 minutes long at 16 kHz), and created around 60 of them overnight. The issue also appears with fewer summaries created, at least on Chrome.

When using Chrome, they only load upon playback. Only the first 5 or so that I play will work; after that (even if I pause them) I can't get the others to play unless I restart TensorBoard. When using Safari, all of them try to load at once and nothing works.

On the TensorBoard side, I see a bunch of error: [Errno 32] Broken pipe, which could mean the browser tries to manage the incoming streams and TensorBoard doesn't know how to defer the transfers (see this post).

For Chrome, there is a limit of 6 concurrent audio downloads. I think in my case the audio keeps the connection open even after I pause it, and instead of downloading the whole file it streams it, so it never closes and I can't play other files. I may need to restart TensorBoard to clear the browser cache, or maybe TensorBoard itself has a limit on the concurrent streams and they don't close even after a page reload. For Safari, I think it doesn't wait until playback to download the files, so all 60 players start the download concurrently and only the first ones survive.

If it's not a bug on the TensorBoard server and the summaries can't be prevented from keeping the connection open on pause or stop, I guess a possible solution could be to have a global player and load the audio files to it on-demand when requesting a summary, rather than each summary having its own player.

teamdandelion avatar Jun 16 '17 18:06 teamdandelion

@rryan did you wind up looking into this?

teamdandelion avatar Jun 16 '17 18:06 teamdandelion

@dandelionmane is anyone looking into this? It seems that audio is still broken for more than a small number of samples. If possible, I would prefer the solution involve pre-downloading the audio, not just downloading when you try to play it, because sometimes the connection between the browser and the TensorBoard server is not very good.

greaber avatar Sep 28 '17 19:09 greaber

@greaber I don't think anyone is looking into this at the moment. If you have an idea on how to fix it, please feel free to do so.

teamdandelion avatar Sep 28 '17 20:09 teamdandelion

It looks like there is recent work on audio by @wchargin. Is that orthogonal to this? I might look into fixing it, but I don't know anything about TensorBoard internals, so it seems like it could take a pretty significant effort for me to get up to speed. Currently, the behavior I see is that in Firefox six random samples show up and the rest not, and in Chrome no samples at all show up.

greaber avatar Sep 28 '17 21:09 greaber

@greaber Yes; everything that I've done is orthogonal to this issue.

I'm not able to reproduce this, either. I duplicated our "audio demo" dataset to make 5 copies, for a total of 30 summaries, and everything that I try—playing multiple clips, pausing some, playing different steps from one sample—works just fine. Even using Array.from($$('audio')).forEach(x => x.play()) works just fine, aside from the obvious cacophany.

These clips are not as long as yours, though; they're 0:02 each at 44.1 kHz.

This is on TensorBoard 0.1.7 and TensorFlow 1.3.0.

I assume that from your comments that you're still running into this; what versions of TensorBoard are you running? and could you post a short script to generate data that reliably reproduces the problem? thanks!

wchargin avatar Sep 28 '17 21:09 wchargin

@wchargin I was actually using TensorBoard 0.1.6, which seems to be the latest version I get from a normal install. But I installed the 0.1.7 wheel, and the problem seems to be gone, so maybe we can close this.

greaber avatar Sep 28 '17 22:09 greaber

Actually, I am still seeing an anomaly that I need to investigate (might just be a bug in my code though).

greaber avatar Sep 28 '17 22:09 greaber

Hmm…I would be very surprised if the 0.1.6→0.1.7 upgrade fixed this. Here's the changelog Do let us know if your investigation turns up anything.

wchargin avatar Sep 28 '17 22:09 wchargin

@wchargin, the anomaly was that I was seeing one less sample in each run than I logged (at least when viewing them in 0.1.7). But I found that when I logged new samples with 0.1.7 they all showed up.

If you think it would be worth it, I can try reinstalling 0.1.6 and making sure that this really did get fixed by the upgrade.

One residual minor inconvenience I have is that I generate samples from separate processes while the model is training (typically multiple runs with different hyperparameters on different GPUs). Since, I believe, you are not supposed to have concurrent writers in TensorBoard, I log to a different subdirectory. But then I end up with empty columns in the audio panel corresponding to the training runs, which never produce samples. Is there a way around this?

greaber avatar Sep 28 '17 22:09 greaber

In your 0.1.6→0.1.7 TensorBoard upgrade, did you perhaps also update TensorFlow? Logging samples using tf.summary.audio is completely independent from the TensorBoard tensorflow-tensorboard package.

You mention "empty columns […] corresponding to runs." Does your audio dashboard still look like a grid with rows corresponding to tags and columns corresponding to runs, as opposed to a simple list—similar to all the other dashboards, and as shown in the following screenshot? New audio dashboard

If so, you are definitely on an old version of TensorBoard. (What are the outputs of pip freeze | grep tensor and type -a tensorboard?)

wchargin avatar Sep 29 '17 00:09 wchargin

I didn't upgrade TensorFlow, but maybe I am on an old version of TensorBoard since I do have this grid view. I just checked the version by looking at tensorboard.main.version.VERSION, but I guess that is only the tensorflow-tensorboard version. I didn't even realize there were two different things. The version of TensorBoard reported by pip freeze is 1.0.0a6.

greaber avatar Sep 29 '17 00:09 greaber

I'm using anaconda. I followed the standard instructions to install TensorFlow 1.3.0, and pip install --upgrade tensorboard doesn't upgrade tensorboard.

greaber avatar Sep 29 '17 00:09 greaber

Actually, maybe this 1.0.0a6 thing wasn't even being used. I was able to pip uninstall it and still run tensorboard.

greaber avatar Sep 29 '17 00:09 greaber

@greaber The pip package is tensorflow-tensorboard and not tensorboard; the latter is an unrelated package. (Sorry for the ambiguity; you're not the first one to be confused by this…cc @dandelionmane FYI more confusion here)

Could you try to pip install --upgrade tensorflow-tensorboard? Ideally, this should install tensorflow-tensorboard==0.1.7, and then if you run hash -r tensorboard; type -a tensorboard you should see something like

$ type -a tensorboard
tensorboard is /home/wchargin/tf1.3-tb0.1.7/bin/tensorboard

and tensorboard --logdir /tmp/data should look like my screenshot above.

wchargin avatar Sep 29 '17 01:09 wchargin

I was already on the latest tensorflow-tensorboard, but something else was screwy in my configuration. I reinstalled TensorFlow and did Shift-Cmd-R in the browser to ignore the cache, and this seems to have gotten me on the latest version. Thanks for all your help!

greaber avatar Sep 29 '17 01:09 greaber

Cool, glad to hear it. You're quite welcome.

I'm not convinced that the underlying problem was ever intentionally fixed, so let us know if it crops up again.

wchargin avatar Sep 29 '17 01:09 wchargin

I guess it may still pop up if there are too many independent summaries. Have you tried the events file I attached with the original thread (provided the format is still compatible)?

I was creating new summaries to track different stages of training, which is solved now by the "time travel" slider, so for my use case it now works fine. Many thanks for revamping the audio plugin! (is there a way to go further back in time than what the slider allows, though? It seems to only keep the N last summaries)

lemonzi avatar Sep 29 '17 09:09 lemonzi

@lemonzi Events files should still be compatible, but I get a 404 on that URL: https://dl.dropboxusercontent.com/u/8226735/events.out.tfevents.1488843003.iAirLemon

The "time travel" slider* should show 10 samples uniformly distributed among all the steps. (Technically, it should always show the most recent step, and should additionally show 9 steps uniformly distributed among the rest.) For instance, I can see steps 1, 2, 6, 12, 16, 21, 24, 34, 44, and 49 on a summary with steps 0…49. If you want to increase the reservoir size from 10 to a larger number, you can change this value in the code: https://github.com/tensorflow/tensorboard/blob/1d2a29a6fb2c36b50da7e08b618f4b3c0d2d72d7/tensorboard/backend/application.py#L59 There is currently not a way to configure this without changing the code.

Does this answer your question?

* This is a much better name than "step selector." You should design our interfaces from now on ;-)

wchargin avatar Sep 29 '17 11:09 wchargin

I haven't tried a truly huge number of players yet. With a moderate number, it works, but it spontaneously reloads all the samples every 30 seconds, cutting off any sample that happens to be playing at the time.

greaber avatar Sep 30 '17 07:09 greaber

@greaber disable auto-reload: click the cog at top-right, then uncheck the "Reload data every 30s." checkbox.

(Ideally auto-reload shouldn't cause the samples to reset…but that is a known issue.)

wchargin avatar Sep 30 '17 11:09 wchargin