如何在 TensorBoard 的嵌入选项卡中选择要查看的检查点? [英] How can I select which checkpoint to view in TensorBoard's embeddings tab?

查看:36
本文介绍了如何在 TensorBoard 的嵌入选项卡中选择要查看的检查点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

小问题:如何在 TensorBoard 的嵌入选项卡中选择要查看的检查点?

<小时>

问题的较长版本:

我想用 TensorBoard 可视化词嵌入.为此,在阅读了

然而,在 TensorBoard 的嵌入选项卡中,我似乎只能查看最新的检查点:

我有时想查看以前时期的嵌入.如何在 TensorBoard 的嵌入选项卡中选择要查看的检查点?

解决方案

我是从事嵌入可视化工具的工程师之一.感谢您的反馈.我们计划在用户界面中添加一个下拉菜单,让您可以选择不同的检查点.

与此同时,有一个解决方法.您可以编辑位于 TensorBoard 保存日志的文件夹中的 projector_config.pbtxt.我假设 projector_config.pbtxt 的内容是:

嵌入{...}

在文件末尾追加以下行:

model_checkpoint_path: "path_to_log_dir/model_0000N.ckpt"

指向您想要可视化的确切检查点,并删除(如果存在)行 model_checkpoint_dir: "...".然后刷新页面(并可能重新运行 TensorBoard).

<小时>

例如,如果您使用 tensorboard --logdir=output 启动了 TensorBoard,并且模型检查点绝对路径为 C:\Users\a\output\en_2017-03-08_17-42-09-310106\model\model_00004.ckpt,那么你应该附加到projector_config.pbtxt:

model_checkpoint_path: "output\en_2017-03-08_17-42-09-310106\model\model_00004.ckpt"

projector_config.pbtxt 示例:

嵌入{张量名称:令牌嵌入/W:0"}model_checkpoint_path: "输出\en_2017-03-08_17-42-09-310106\model\model_00004.ckpt"

如果当你点击 TensorBoard 中的 embeddings 选项卡时没有任何显示,则表示你输入的 model_checkpoint_path 不正确.

希望这会有所帮助!

Short question: How can I select which checkpoint to view in TensorBoard's embeddings tab?


Longer version of the question:

I want to visualize word embeddings with TensorBoard. To that end, after reading the official tutorial (mirror) I added following code:

embedding_writer = tf.summary.FileWriter(model_folder)     
embeddings_projector_config = projector.ProjectorConfig()
embedding = embeddings_projector_config.embeddings.add()
embedding.tensor_name = model.W.name # W corresponds to the embeddings' weights.
projector.visualize_embeddings(embedding_writer, embeddings_projector_config)

# Initialize the model
sess.run(tf.global_variables_initializer())

[...]

# Then, for each training epoch:
model_saver.save(sess, os.path.join(model_folder, 'model_{0:05d}.ckpt'.format(epoch_number)))

Looking at the folder where TensorFlow saves the log, I do have a checkpoint for each epoch:

However, in TensorBoard's embeddings tab it seems that I can only view the latest checkpoint:

I sometimes would like to view the embeddings for previous epochs. How can I select which checkpoint to view in TensorBoard's embeddings tab?

解决方案

I'm one of the engineers working on the embedding visualizer. Thanks for the feedback. We are planning to add a dropdown menu in the UI that allows you to choose different checkpoints.

In the meantime, there is a workaround. You can edit the projector_config.pbtxt that lives in the folder where TensorBoard saves the log. I'm assuming the contents of projector_config.pbtxt are:

embeddings {
...
}

Append the following line at the end of the file:

model_checkpoint_path: "path_to_log_dir/model_0000N.ckpt"

pointing to the exact checkpoint you want to visualize, and remove (if it exists) the line model_checkpoint_dir: "...". Then refresh the page (and potentially re-run TensorBoard).


For example, if you have launched TensorBoard with tensorboard --logdir=output, and the model checkpoint absolute path is C:\Users\a\output\en_2017-03-08_17-42-09-310106\model\model_00004.ckpt, then you should append to projector_config.pbtxt:

model_checkpoint_path: "output\en_2017-03-08_17-42-09-310106\model\model_00004.ckpt"

Example of projector_config.pbtxt:

embeddings {
  tensor_name: "token_embedding/W:0"
}
model_checkpoint_path: "output\en_2017-03-08_17-42-09-310106\model\model_00004.ckpt"

If when you click to the embeddings tab in TensorBoard nothing appears, it means that the model_checkpoint_path you have entered is incorrect.

Hope this helps!

这篇关于如何在 TensorBoard 的嵌入选项卡中选择要查看的检查点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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