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

Projector tab does not appear when tensorboard is launched with tensorboard.program #3683

Closed
hvcdrake opened this issue May 30, 2020 · 4 comments · Fixed by #3695
Closed

Comments

@hvcdrake
Copy link

Hello,

Running Tensorboard from command line

Launching Tensorboard from the command line works. When i click in the projector opction from the selector i get the hoped result.

Launching line:
tensorboard --logdir="other_logs" --host="127.0.0.1" --port="6010"

image

Running Tensorboard from python script

The issue comes when i run tensorboard from a python script. The projector option does not appear. Getting /#projector did not work neither. It's that launching tensorboard in different ways is leading to theese results.

image

I tested this with the imdb example from the documentation page (https://www.tensorflow.org/tensorboard/tensorboard_projector_plugin).

Also tested with a custom log directory. All log dirrectories are attached.

tb_launch_issue.zip

I know that it could seem trivial but we really need to launch tensorboard on demmand from a python program. Maybe am i doing something wrong?

Thanks in advance.

Python Script

from tensorboard import program
import os.path


ld=os.path.abspath("other_logs") # Try with imdb-example or other_logs 
h="127.0.0.1" # Localhost
p="6010" # Port

# Initating an launching tensorboard
tb = program.TensorBoard()
tb.configure(argv=[None, '--logdir', ld, '--host', h, '--port', p])
tb.main()

Enviroment

os: Windows 10
python: 3.6.9
tensorboard: 2.1.0
tensorflow: 2.1.0 // Also tested with tb-nightly

@wchargin
Copy link
Contributor

wchargin commented Jun 2, 2020

Hi @hvcdrake! Thanks for the report. The projector plugin is loaded a
bit differently from most TensorBoard-bundled plugins, using a “dynamic
plugin” mechanism that finds the plugins to load at runtime. The catch
is that we currently only load dynamic plugins through tensorboard(1),
not through tensorboard.program; compare:

default.get_plugins() + default.get_dynamic_plugins(),

if plugins is None:
from tensorboard import default
plugins = default.get_plugins()

I’ll send out a patch for this; thanks!

wchargin added a commit that referenced this issue Jun 2, 2020
Summary:
The `tensorboard.program.TensorBoard` API now includes dynamic plugins
by default; previously, it only included static plugins. Fixes #3683.

We effect this change by modifying the internal `default.get_plugins`
method to return all the plugins to prevent this kind of confusion in
the future.

Test Plan:
Launch TensorBoard from a small Python script:

```python
from tensorboard import program
import tensorboard as tb

program = tb.program.TensorBoard()
program.configure(logdir="/tmp/logs", bind_all=True)
program.main()
```

…and note that the projector plugin now shows up in the list of plugins,
whereas previously it was not loaded (neither active nor inactive). Note
that normal `tensorboard(1)` also still shows the correct plugins.

wchargin-branch: program-include-dynamic-plugins
wchargin-source: 4dbe59377617823c829a721e3c64cd8bc2dfcc90
@wchargin
Copy link
Contributor

wchargin commented Jun 2, 2020

Also, pro tip—

tb.configure(argv=[None, '--logdir', ld, '--host', h, '--port', p])

—you can configure these with a nicer kwargs API:

ld = os.path.abspath(...)
h = "127.0.0.1"
p = 6010  # note: a real integer, not "6010"

tb.configure(logdir=ld, host=h, port=p)

Then, you don’t have to worry about escaping or flag syntax or anything.

wchargin added a commit that referenced this issue Jun 3, 2020
Summary:
The `tensorboard.program.TensorBoard` API now includes dynamic plugins
by default; previously, it only included static plugins. Fixes #3683.

We effect this change by modifying the internal `default.get_plugins`
method to return all the plugins to prevent this kind of confusion in
the future.

Test Plan:
Launch TensorBoard from a small Python script:

```python
import tensorboard as tb

program = tb.program.TensorBoard()
program.configure(logdir="/tmp/logs", bind_all=True)
program.main()
```

…and note that the projector plugin now shows up in the list of plugins,
whereas previously it was not loaded (neither active nor inactive). Note
that normal `tensorboard(1)` also still shows the correct plugins.

wchargin-branch: program-include-dynamic-plugins
@hvcdrake
Copy link
Author

hvcdrake commented Jun 3, 2020

Hi @hvcdrake! Thanks for the report. The projector plugin is loaded a
bit differently from most TensorBoard-bundled plugins, using a “dynamic
plugin” mechanism that finds the plugins to load at runtime. The catch
is that we currently only load dynamic plugins through tensorboard(1),
not through tensorboard.program; compare:

default.get_plugins() + default.get_dynamic_plugins(),

if plugins is None:
from tensorboard import default
plugins = default.get_plugins()

I’ll send out a patch for this; thanks!

Got it! Thanks @wchargin

@hvcdrake
Copy link
Author

hvcdrake commented Jun 3, 2020

Also, pro tip—

tb.configure(argv=[None, '--logdir', ld, '--host', h, '--port', p])

—you can configure these with a nicer kwargs API:

ld = os.path.abspath(...)
h = "127.0.0.1"
p = 6010  # note: a real integer, not "6010"

tb.configure(logdir=ld, host=h, port=p)

Then, you don’t have to worry about escaping or flag syntax or anything.

Cool! Thanks : )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants