python - 以编程方式读出tensorboard hparams

标签 python pytorch tensorboard hyperparameters

使用 PyTorch 运行超参数搜索并在 Tensorboard 中可视化结果后,我想以编程方式从 Tensorboard 中读出超参数。

我的文件夹结构是

  • 所有运行
    • 运行1
      • Loss_trainingloss
      • 1634168941.9091413(或其他时间戳) events.out.tfevents.1634168941
      • events.out.tfevents.1634135651
    • 运行2
    • 运行3

我可以轻松阅读张量板时间序列,例如损失曲线的代码如下:

from tensorboard.backend.event_processing.event_accumulator import EventAccumulator

def read_eventfile(filepath, tag):
    event_accumulator = EventAccumulator(filepath)
        event_accumulator.Reload()

        events = event_accumulator.Scalars(tag)

        y = [x.value for x in events]

        return y

train_loss_curve = read_eventfile(path_to_event_folder, "Loss_trainingloss")

但是,我很难找到每次运行的 hparams 的访问权限,这些 hparams 正确显示在张量板上。有人知道如何做到这一点吗?

谢谢!

最佳答案

我刚刚完成了一个名为 tbparse 的工具轻松读取 hparams 事件,如下所示:

from tbparse import SummaryReader
log_dir = "<PATH_TO_EVENT_FILE_OR_DIRECTORY>"
reader = SummaryReader(log_dir)
hp = reader.hparams
print(hp)

参见the documentation更多用途。

关于python - 以编程方式读出tensorboard hparams,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70033253/

相关文章:

python - 弃用警告 : Function when moving app (removed titlebar) - PySide6

python - flask send_file 不适用于 tar.gz 文件

python - Cuda和pytorch内存使用

tensorflow - 如何使用TensorBoard分析结果并降低均方误差

python - 带有很少需要的参数的 python 函数

python - 在 Python 中,如何以随机顺序打印文本文件中的行?

deep-learning - 如何在 Detectron2 中保存和加载自定义数据集的模型?

pytorch - 找不到就地操作导致 "RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation:"

python - 通过 pip 安装后 Tensorboard 错误

python - Sagemaker 在训练期间不将 Tensorboard 日志输出到 S3