当前位置:  开发笔记 > 编程语言 > 正文

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

如何解决《如何在TensorBoard的嵌入选项卡中选择要查看的检查点?》经验,为你挑选了1个好方法。

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


问题的较长版本:

我想用TensorBoard可视化单词嵌入。为此,在阅读了官方教程 (镜像)后,我添加了以下代码:

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)))

查看TensorFlow保存日志的文件夹,我确实为每个纪元都有一个检查点:

但是,在TensorBoard的嵌入选项卡中,看来我只能查看最新的检查点:

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



1> dsmilkov..:

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"

如果在TensorBoard中单击嵌入选项卡时没有任何显示,则表明model_checkpoint_path您输入的不正确。

希望这可以帮助!

推荐阅读
重庆制造漫画社
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有