How can I run Tensorboard on a remote server?

前端 未结 12 1734
青春惊慌失措
青春惊慌失措 2020-12-12 09:19

I\'m new to Tensorflow and would greatly benefit from some visualizations of what I\'m doing. I understand that Tensorboard is a useful visualization tool, but how do I run

相关标签:
12条回答
  • 2020-12-12 09:29

    You can directly run the following command on terminal of your remote server to run tensorboard:

    tensorboard --logdir {tf_log directory path} --host "0.0.0.0" --port 6006
    

    Or you can also start the tensorboard within your ipython notebook:

    %load_ext tensorboard
    %tensorboard --logdir {tf_log directory path} --host "0.0.0.0" --port 6006
    
    0 讨论(0)
  • 2020-12-12 09:34

    You can port-forward with another ssh command that need not be tied to how you are connecting to the server (as an alternative to the other answer). Thus, the ordering of the below steps is arbitrary.

    1. from your local machine, run

      ssh -N -f -L localhost:16006:localhost:6006 <user@remote>

    2. on the remote machine, run:

      tensorboard --logdir <path> --port 6006

    3. Then, navigate to (in this example) http://localhost:16006 on your local machine.

    (explanation of ssh command:

    -N : no remote commands

    -f : put ssh in the background

    -L <machine1>:<portA>:<machine2>:<portB> :

    forward <machine1>:<portA> (local scope) to <machine2>:<portB> (remote scope)

    0 讨论(0)
  • 2020-12-12 09:36

    Another option if you can't get it working for some reason is to simply mount a logdir directory on your filesystem with sshfs:

    sshfs user@host:/home/user/project/summary_logs ~/summary_logs

    and then run Tensorboard locally.

    0 讨论(0)
  • 2020-12-12 09:38

    This is not a proper answer but a troubleshooter, hopefully helps other less seasoned networkers like me.

    In my case (firefox+ubuntu16) the browser was connecting, but showing a blank page (with the tensorboard logo on the tab), and no log activity at all was shown. I still don't know what could be the reason for that (didn't look much into it but if anybody knows please let know!), but I solved it switching to ubuntu's default browser. Here the exact steps, pretty much the same as in @Olivier Moindrot's answer:

    1. On the server, start tensorboard: tensorboard --logdir=. --host=localhost --port=6006
    2. On the client, open the ssh tunnel ssh -p 23 <USER>@<SERVER> -N -f -L localhost:16006:localhost:6006
    3. Open ubuntu's Browser and visit localhost:16006. The tensorboard page should load without much delay.

    To check that the SSH tunnel is effectively working, a simple echo server like this python script can help:

    1. Put the script into an <ECHO>.py file in the server and run it with python <ECHO>.py. Now the server will have the echo script listening on 0.0.0.0:5555.
    2. On the client, open the ssh tunnel ssh -p <SSH_PORT> <USER>@<SERVER> -N -f -L localhost:12345:localhost:5555
    3. On the client, in the same terminal used to open the tunnel (step 2.), issuing telnet localhost 12345 will connect to the echo script running in the server. Typing hello and pressing enter should print hello back. If that is the case, your SSH tunnel is working. This was my case, and lead me to the conclusion that the problem involved the browser. Trying to connect from a different terminal caused the terminal to freeze.

    As I said, hope it helps!
    Cheers,
    Andres

    0 讨论(0)
  • You have to create a ssh connection using port forwarding:

    ssh -L 16006:127.0.0.1:6006 user@host
    

    Then you run the tensorboard command:

    tensorboard --logdir=/path/to/logs
    

    Then you can easily access the tensorboard in your browser under:

    localhost:16006/
    
    0 讨论(0)
  • 2020-12-12 09:40

    While running the tensorboard give one more option --host=ip of your system and then you can access it from other system using http://ip of your host system:6006

    0 讨论(0)
提交回复
热议问题