为什么这段代码不会产生一个 tensorboard 可读的日志? [英] Why does this code not produce a log that is readable by tensorboard?

查看:32
本文介绍了为什么这段代码不会产生一个 tensorboard 可读的日志?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 WINdows 10 上使用 Python (3.6)/Jupyter (5.7.8) .. 我尝试了许多尝试为张量板生成日志文件的简单示例,包括:

Using Python (3.6) / Jupyter (5.7.8) on WIndows 10 .. I have tried many simple examples of trying to generate log files for tensorboard including this:

logs_base_dir = "C:/tensorlogs"
%load_ext tensorboard.notebook
# %tensorboard --port=6006 --logdir {logs_base_dir}

os.makedirs(logs_base_dir, exist_ok=True)
%tensorboard --port=6008 --logdir {logs_base_dir}

a = tf.constant([10])
b = tf.constant([20])
c = tf.add(a,b)

with tf.Session() as sess:
    # or creating the writer inside the session
    writer = tf.summary.FileWriter(logs_base_dir, sess.graph)
    print(sess.run(c))

writer.close()
sess.close()

我看到在C:/tensorlogs"文件夹中创建了一个名为:events.out.tfevents.1563219145.DESKTOP-5HG12IB"的日志文件

I see a logfile created in the 'C:/tensorlogs' folder called: 'events.out.tfevents.1563219145.DESKTOP-5HG12IB'

我还可以看到在单独的浏览器窗口中运行的 tensorboard.在缩放器"页面上,它列出了正确的源文件夹C:/tensorflow".

I can also see tensorboard running in a separate browser window. On the 'scaler' page it lists the correct source folder 'C:/tensorflow'.

但张量板显示没有会话正在运行.

But tensorboard indicate that no session is running.

我做错了什么?有没有办法检查该日志文件是否合法?

What am I doing wrong? Is there any way of checking that log file to see if it is legitimate?

显示张量板正在运行的浏览器窗口 - 但未找到日志文件

(也在图形窗口上不显示任何内容)

(Also shows nothing on graph window)

更新:我尝试使用以下命令从命令行运行 tensorboard:

Update: I tried to run tensorboard from the command line using:

张量板 --logdir='c:/tensorlogs' --port=6006

tensorboard --logdir='c:/tensorlogs' --port=6006

它具有相同的行为..页面在浏览器中显示而没有数据.终端显示以下消息:

It has the same behaviour .. page shows in browser with no data. Terminal displays the following messages:

TensorBoard 1.13.1 在 http://DESKTOP-5HG12IB:6006(按 CTRL+C 退出)I0716 06:56:05.074265 3780 _internal.py:122] ::1 - - [16/Jul/2019 06:56:05] "[37mGET/data/experiments HTTP/1.1[0m" 200 -I0716 06:56:05.086722 8400 _internal.py:122] ::1 - - [16/Jul/2019 06:56:05] "[37mGET/data/environment HTTP/1.1[0m" 200 -I0716 06:56:05.088708 3780 _internal.py:122] ::1 - - [16/Jul/2019 06:56:05] "[37mGET/data/plugins_listing HTTP/1.1[0m" 200 -I0716 06:56:05.090195 8400 _internal.py:122] ::1 - - [16/Jul/2019 06:56:05] "[37mGET/data/runs HTTP/1.1[0m" 200 -I0716 06:56:05.099200 3780 _internal.py:122] ::1 - - [16/Jul/2019 06:56:05] "[37mGET/data/plugin/scalars/tags HTTP/1.1[0m" 200 -I0716 06:56:13.198990 3780 _internal.py:122] ::1 - - [16/Jul/2019 06:56:13] "[37mGET/HTTP/1.1[0m" 200 -I0716 06:56:14.169489 3780 _internal.py:122] ::1 - - [16/Jul/2019 06:56:14] "[37mGET/tf-interactive-inference-dashboard/editedexample.png HTTP/1.1[0m]"200 -I0716 06:56:14.170989 8400 _internal.py:122] ::1 - - [16/Jul/2019 06:56:14][37mGET/tf-interactive-inference-dashboard/distance.png HTTP/1.1[0m]"200 -I0716 06:56:14.174491 3780 _internal.py:122] ::1 - - [16/Jul/2019 06:56:14][37mGET/tf-interactive-inference-dashboard/pdplots.png HTTP/1.1[0m]"200 -I0716 06:56:14.176498 12340 _internal.py:122] ::1 - - [16/Jul/2019 06:56:14][37mGET/tf-interactive-inference-dashboard/explorecounterfactuals.png0m/1."200 -I0716 06:56:14.281985 12876 _internal.py:122] ::1 - - [16/Jul/2019 06:56:14] "[37mGET/data/experiments HTTP/1.1[0m" 200 -I0716 06:56:14.282483 8400 _internal.py:122] ::1 - - [16/Jul/2019 06:56:14] "[37mGET/data/runs HTTP/1.1[0m" 200 -I0716 06:56:14.282483 12340 _internal.py:122] ::1 - - [16/Jul/2019 06:56:14][37mGET/data/environment HTTP/1.1[0m"200 -..还有更多......

TensorBoard 1.13.1 at http://DESKTOP-5HG12IB:6006 (Press CTRL+C to quit) I0716 06:56:05.074265 3780 _internal.py:122] ::1 - - [16/Jul/2019 06:56:05] "[37mGET /data/experiments HTTP/1.1[0m" 200 - I0716 06:56:05.086722 8400 _internal.py:122] ::1 - - [16/Jul/2019 06:56:05] "[37mGET /data/environment HTTP/1.1[0m" 200 - I0716 06:56:05.088708 3780 _internal.py:122] ::1 - - [16/Jul/2019 06:56:05] "[37mGET /data/plugins_listing HTTP/1.1[0m" 200 - I0716 06:56:05.090195 8400 _internal.py:122] ::1 - - [16/Jul/2019 06:56:05] "[37mGET /data/runs HTTP/1.1[0m" 200 - I0716 06:56:05.099200 3780 _internal.py:122] ::1 - - [16/Jul/2019 06:56:05] "[37mGET /data/plugin/scalars/tags HTTP/1.1[0m" 200 - I0716 06:56:13.198990 3780 _internal.py:122] ::1 - - [16/Jul/2019 06:56:13] "[37mGET / HTTP/1.1[0m" 200 - I0716 06:56:14.169489 3780 _internal.py:122] ::1 - - [16/Jul/2019 06:56:14] "[37mGET /tf-interactive-inference-dashboard/editedexample.png HTTP/1.1[0m" 200 - I0716 06:56:14.170989 8400 _internal.py:122] ::1 - - [16/Jul/2019 06:56:14] "[37mGET /tf-interactive-inference-dashboard/distance.png HTTP/1.1[0m" 200 - I0716 06:56:14.174491 3780 _internal.py:122] ::1 - - [16/Jul/2019 06:56:14] "[37mGET /tf-interactive-inference-dashboard/pdplots.png HTTP/1.1[0m" 200 - I0716 06:56:14.176498 12340 _internal.py:122] ::1 - - [16/Jul/2019 06:56:14] "[37mGET /tf-interactive-inference-dashboard/explorecounterfactuals.png HTTP/1.1[0m" 200 - I0716 06:56:14.281985 12876 _internal.py:122] ::1 - - [16/Jul/2019 06:56:14] "[37mGET /data/experiments HTTP/1.1[0m" 200 - I0716 06:56:14.282483 8400 _internal.py:122] ::1 - - [16/Jul/2019 06:56:14] "[37mGET /data/runs HTTP/1.1[0m" 200 - I0716 06:56:14.282483 12340 _internal.py:122] ::1 - - [16/Jul/2019 06:56:14] "[37mGET /data/environment HTTP/1.1[0m" 200 - .. and lots more ...

推荐答案

你可能没有关于 tensorboard 的基础知识,所以让我解释一下.您创建了一个图表,并将其记录到一个文件中.您的日志文件将包含的唯一内容是带有单个运算符 (Add) 和两个输入的图形.

You might not have the basics about tensorboard so let me explain a bit. You created a graph, and logged it to a file. The only thing your log file will contain is a graph with a single operator (Add) and two inputs.

在训练神经网络时,通常会记录标量以跟踪您的损失函数,这似乎就像一个体面的向导.

Logging scalars is often done to track your loss function when training neural networks, this seems like a decent guide.

编辑

1) 您确定 tensorboard 的路径正确吗?您可以转到终端中的日志文件夹并从那里运行 tensorboard --logdir ./ 吗?

1) Are you sure tensorboard is getting your path correctly? Can you go to your log folder in the terminal and run tensorboard --logdir ./ from there?

2) 尝试使用",我尝试使用以下命令:

2) try using "", I tried using the following commands:

tensorboard --logdir ./
tensorboard --logdir="./"
tensorboard --logdir='./'

底部的一个在浏览器中显示错误,其他两个工作正常../应该可以替换为任何文件夹,我只是更喜欢在 Windows 的终端中进入我的文件夹,以防止任何路径中断

The bottom one gave an error in browser displaying nothing, other 2 worked fine. The ./ should be replacable with any folder, I just prefer to go into my folder in terminal on windows, to prevent any path from breaking

3) 您是否尝试过 tensorflow 安装,您的 tensorboard 可能与您的 tensorflow 不完全兼容吗?您是否尝试过卸载每个 tensorboard/tensorflow 包,然后重新安装它们?这些是我的版本:

3) Have you played around with tensorflow installations, is your tensorboard perhaps not fully compatible with your tensorflow? Have you tried uninstalling every tensorboard / tensorflow package, and installing them again? These are my versions:

tensorboard==1.13.1
tensorflow==1.13.1

这篇关于为什么这段代码不会产生一个 tensorboard 可读的日志?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆