python - 部署 Tensorboard 插件

标签 python plugins tensorboard bazel

根据这个官方 Tensorboard 插件示例:

https://github.com/tensorflow/tensorboard-plugin-example

使用自定义 Tensorboard 插件的唯一方法是构建包含该插件的自定义 Tensorboard。这看起来很奇怪(我想集成自定义插件的更好方法是以某种方式将其注册到“标准”Tensorboard,或者将其名称/路径作为参数传递给 Tensorboard)。这是一种奇怪的方法,但我可以忍受。真正困扰我的是,从上面的示例来看,启动自定义 Tensorboard 的唯一方法是使用“bazel run”命令

bazel run //greeter_tensorboard -- --logdir=/tmp/greeter_demo

或者也许我错了,可以在没有 Bazel 的情况下启动自定义 TensorBoard 吗?我对 Python 和 Tensorboard 都很陌生,所以我无法找到不同的启动方式。不幸的是,该示例附带的 README.md 并没有过多介绍如何部署 Tensorboard 插件,而是提供了 Tensorboard README 和 Bazel 文档的链接。但我无法在那里找到有关部署插件和自定义张量板的任何有用信息。

Integration

Once you have a plugin (or, more realistically, as you are developing it), you will want to use it inside TensorBoard. To do that, we recommend you fork this repository; it has everything set up for you.

Basically, the way you integrate a new plugin is by creating a custom TensorBoard build. The custom build needs to change two things:

  1. It needs to use its own main.py file, which imports the standard TensorBoard plugins, and adds a new one on the backend.
  2. It needs to provide its own index.html file, which imports the new TensorBoard plugin frontend, and registers it as a dashboard.

If you want to really understand what’s going on with the integration, you’ll need to understand Bazel, our build system. You can read the Bazel docs and also our compilation of useful tips.

如果这是启动自定义张量板的唯一方法,这意味着我的自定义张量板的每个用户都必须安装 Bazel,并从 C++ 和 Python 源构建自定义张量板。但我什至无法让 Bazel 在 Windows 上构建这个 Greeter 示例,因为 VC15 编译器(Visual Studio 2017 附带的编译器)无法编译 TensorBoard 中使用的 C++(我猜是因为 VC 不完全支持现代 C++ 标准)。我只能在 Linux 上构建它。 所以我的问题是:自定义张量板到底应该如何分发和启动?没有 Bazel 是否可以做到这一点?

最佳答案

我已经弄清楚如何创建自定义 Greeter 演示张量板的发行版并在没有 Bazel 的情况下运行它。假设 Greeter 演示张量板代码已克隆到 ~/tensorboard-plugin-example 中。使用以下命令构建插件和张量板后:

bazel run //greeter_plugin:greeter_demo
bazel run //greeter_tensorboard -- --logdir=/tmp/greeter_demo
  1. greeter_tensorboard目录从~/tensorboard-plugin-example复制到~/

  2. ~/tensorboard-plugin-example/greeter_plugin目录复制到~/greeter_tensorboard

  3. 将文件 assets.zip~/tensorboard-plugin-example/bazel-bin/greeter_tensorboard 复制到 ~/greeter_tensorboard>

您现在可以使用以下命令启动自定义 Greeter 张量板:

python ~/greeter_tensorboard/main.py --logdir=/tmp/greeter_demo

假设运行/tmp/greeter_demo目录下已经生成了测试数据

bazel run //greeter_plugin:greeter_demo

命令。

关于python - 部署 Tensorboard 插件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53637674/

相关文章:

grails - 使用带有可搜索插件的自定义ID列映射

python - Tensorboard:OSError:[Errno 22] 尝试从命令提示符运行 tensorflow 时参数无效

python - Tensorboard 属性错误 : 'ModelCheckpoint' object has no attribute 'on_train_batch_begin'

python - 如何在 python pandas 中找到具有多索引的两个数据框列的最小值?

python - 如何使用 scapy 和 python 提取 SSL/TLS 消息?

python - 在 numpy 中获取日志返回的最有效方法是什么

python - python中如何获取项目根目录下子文件夹的路径?

ssl - 为 logstash-output-stomp 使用 SSL

java - 将 Maven 项目转换为 Netbeans 项目

python - Tensorflow:如何创建混淆矩阵