tensorboard报错解决:No dashboards are active for the current data set

版本:tensorboard 2.10.0

问题:文件夹下明明有events文件,但用tensorboard命令却无法显示。

例如:

原因:有可能是文件路径太长了,导致系统无法读取文件。在win系统中规定,目录的绝对路径不得超过260字符,虽然在win10的1607及以上版本中支持更大路径长度,但并非所有应用都能支持长路径。在上面的例子中,我的数据目录是"D:\xxx\files\syn_1x1_uniform_1_20s\tensorboard_drl\train\rlhf_h32_16_alphap2_gammap92_bs64_memo1e5_rand_start10batch_round1e5\hold_steps\events.out.tfevents.1699542553.autodl-container-744e4495ab-36126ec8.1799.0",共262字符,可能是我当前tensorboard版本限制或其他原因无法读取。

解决方案:

  1. 把events文件保存在浅层目录中,路径不超过260字符,再重新用tensorboard命令查看
  2. 使用event_accumulator直接从events读取数据,避开tensorboard命令调用过程。以下为简单示例,仅供参考,关键函数为event_accumulator.EventAccumulator。
python 复制代码
from tensorboard.backend.event_processing import event_accumulator
import os
current_path = os.path.dirname(os.path.abspath(__file__))  # 当前代码文件所在文件夹的绝对路径
file_path = os.path.join(current_path, '../files/syn_1x1_uniform_1_20s/tensorboard_drl/fix_init10/events.out.tfevents.1689403580.99a6dc21500a.1450.0')  # 数据相对路径
ea = event_accumulator.EventAccumulator(file_path)  # 不限制读取数据点数
ea.Reload()
print(ea.scalars.Keys())
key=ea.scalars.Keys()[0]
val = ea.scalars.Items(key)
print(len(val))
print([(i.step, i.value) for i in val])

参考文献:

  1. Windows路径字符长度限制问题
相关推荐
就叫你天选之人啦15 小时前
安装torch+vllm+flash_attn的prompt
人工智能·pytorch·python
Thomas.Sir2 天前
第16课:PyTorch|循环神经网络RNN与序列数据处理【让模型拥有“记忆”】
人工智能·pytorch·rnn
失舵之舟-2 天前
【全步骤】Pytorch 搭建自己的Unet语义分割平台
pytorch·语义分割·unet
盼小辉丶2 天前
PyTorch强化学习实战——分布式策略梯度
人工智能·pytorch·深度学习·强化学习
jzshmyt2 天前
我用 Python 从零“生成“了一个宇宙,然后让它观察自己(v14)
人工智能·pytorch·python·numpy·matplotlib·空间计算·scipy
Thomas.Sir3 天前
第13课:PyTorch|经典CNN网络模型从零复现【从LeNet到VGG的逐行实现】
网络·pytorch·cnn
Thomas.Sir3 天前
第7课:PyTorch|激活函数全品类详解与选型实战【神经网络的“火花塞”】
人工智能·pytorch·神经网络
Thomas.Sir3 天前
第10课:PyTorch|学习率调度策略全面精讲【训练过程的“自适应巡航”】
人工智能·pytorch·学习
Thomas.Sir3 天前
第4课:PyTorch|自动微分Autograd机制深度解析【深度学习的“发动机”】
人工智能·pytorch·深度学习
维基框架3 天前
坊间传闻 OpenAI 将要发布GPT-6 Sol 模型
人工智能·pytorch·python