先上答案:
python3 -m tensorboard.main --logdir ./ --bind_all
./ 是当前文件夹。
在远程服务器上执行如下命令启动tensorboard的服务之后:
tensorboard --logdir logs
无法在本地PC上打开tensorboard的网页:
http://server_ip:6006
执行tensorboard --logdir logs命令有如下提示:
liguanlin@opt48:/mnt/liguanlin/codes/papercodes/paper_reimplementation/GAN/DCGAN$ tensorboard --logdir logs
2021-03-02 17:08:08.590885: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'libcudart.so.10.1'; dlerror: libcudart.so.10.1: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/local/lib:
2021-03-02 17:08:08.590917: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
Serving TensorBoard on localhost; to expose to the network, use a proxy or pass --bind_all
TensorBoard 2.3.0 at http://localhost:6006/ (Press CTRL+C to quit)
log中有这样一句话:
Serving TensorBoard on localhost; to expose to the network, use a proxy or pass --bind_all
要想成功打开这个网址:
http://server_ip:6006
可以执行如下命令:
tensorboard --logdir logs --bind_all
--bind_all的作用是to expose to the network
Linux alias命令用于设置指令的别名。
用户可利用alias,自定指令的别名。若仅输入alias,则可列出目前所有的别名设置。alias的效力仅及于该次登入的操作。若要每次登入是即自动设好别名,可在.profile或.cshrc中设定指令的别名。
zsh: command not found: tensorboard
第一种解决方案:
alias tensorboard='python3 -m tensorboard.main'
第二种解决方案:
python3 -m tensorboard.main --logdir=.
第三种解决方案:
将alias命令放到 .zshrc 里