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

Improve handling of tensorboard #2126

Merged

Conversation

twalcari
Copy link
Contributor

Describe your changes

Problem statement

Tensorboard is a utility that is frequently used by developers working with TensorFlow or PyTorch to visually inspect their work. It is included by default when installing TensorFlow, and is even part of the very first Get Started notebook of TensorFlow. It integrates into Jupyter notebooks via an extension (%load_ext tensorboard), after which you can request the TensorBoard UI via the magic command %tensorboard .

TensorBoard works by launching an additional process which listens on port 6006 (typically). However, this means that you also need to expose that extra port when starting an tensorflow-notebook instance:

docker run -p 10000:8888 -p 6006:6006 quay.io/jupyter/jupyter-notebook:latest .

If you fail to do this, you are greeted with a "Connection refused" error:

tensorboard-problem

The situation is even more problematic when the image is started via JupyterHub: in many cases the user cannot open an extra port, and certainly not on port 6006.

Proposed solution

After looking into how CoLab solved this problem, I found an environment variable TENSORBOARD_PROXY_URL that can be used to specify a custom target location of the iframe being injected into the notebook.

This PR does 2 things:

  • it adds jupyter-server-proxy to the image
  • it properly configures the TENSORBOARD_PROXY_URL environment variable to use jupyter-server-proxy. It's done in a way that works both in the standalone case and in the JupyterHub case.

tensorboard-fixed

Issue ticket if applicable

Checklist (especially for first-time contributors)

  • I have performed a self-review of my code
  • If it is a core feature, I have added thorough tests
  • I will try not to use force-push to make the review process easier for reviewers
  • I have updated the documentation for significant changes

benz0li added a commit to b-data/jupyterlab-julia-docker-stack that referenced this pull request Jul 20, 2024
benz0li added a commit to b-data/jupyterlab-mojo-docker-stack that referenced this pull request Jul 20, 2024
benz0li added a commit to b-data/jupyterlab-python-docker-stack that referenced this pull request Jul 20, 2024
benz0li added a commit to b-data/jupyterlab-r-docker-stack that referenced this pull request Jul 20, 2024
benz0li added a commit to b-data/data-science-devcontainers that referenced this pull request Jul 20, 2024
@mathbunnyru mathbunnyru reopened this Jul 25, 2024
@mathbunnyru
Copy link
Member

@twalcari sorry for not mentioning it earlier, please update the following doc: https://github.com/jupyter/docker-stacks/blob/main/docs/using/selecting.md#jupytertensorflow-notebook

@mathbunnyru
Copy link
Member

mathbunnyru commented Jul 25, 2024

@mathbunnyru, @consideRatio, @yuvipanda, and @manics, please vote 👍 to accept this change and 👎 not to accept it (use a reaction to this message)

The voting deadline is the 1st of August (a week since I posted this message).
The change is accepted, if there are at least 2 positive votes.

We can have a discussion until the deadline, so please express your opinions.

@twalcari
Copy link
Contributor Author

@twalcari sorry for not mentioning it earlier, please update the following doc: https://github.com/jupyter/docker-stacks/blob/main/docs/using/selecting.md#jupytertensorflow-notebook

What do you want me to add there? Tensorboard is an utility that is distributed together with tensorflow, so I don't think we should mention it separately? Do I need to mention jupyter-server-proxy there?

@mathbunnyru
Copy link
Member

@twalcari sorry for not mentioning it earlier, please update the following doc: https://github.com/jupyter/docker-stacks/blob/main/docs/using/selecting.md#jupytertensorflow-notebook

What do you want me to add there? Tensorboard is an utility that is distributed together with tensorflow, so I don't think we should mention it separately? Do I need to mention jupyter-server-proxy there?

I would only mention jupyter-server-proxy.

@mathbunnyru mathbunnyru merged commit 1ad688e into jupyter:main Aug 1, 2024
74 checks passed
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