Fra*_*urt 3 python tensorflow tensorboard
简短的问题:如何在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)))
Run Code Online (Sandbox Code Playgroud)
查看TensorFlow保存日志的文件夹,我确实为每个纪元都有一个检查点:
但是,在TensorBoard的嵌入选项卡中,看来我只能查看最新的检查点:
有时,我想查看以前时期的嵌入内容。如何在TensorBoard的嵌入选项卡中选择要查看的检查点?
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 {
...
}
Run Code Online (Sandbox Code Playgroud)
Append the following line at the end of the file:
model_checkpoint_path: "path_to_log_dir/model_0000N.ckpt"
Run Code Online (Sandbox Code Playgroud)
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"
Run Code Online (Sandbox Code Playgroud)
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"
Run Code Online (Sandbox Code Playgroud)
如果在TensorBoard中单击嵌入选项卡时没有任何显示,则表明model_checkpoint_path您输入的不正确。
希望这可以帮助!
| 归档时间: |
|
| 查看次数: |
1775 次 |
| 最近记录: |