Skip to main content

用于跟踪、记录和复制软件运行的实用程序。

项目描述

https://travis-ci.org/lobachevzky/lab-notebook.svg?branch=master

实验室笔记本

计算机科学的研究人员经常需要比较不同版本的过程之间的结果。 Lab Notebook有助于记录、跟踪和组织处理这些类型的运行。这对于可重复性至关重要,并帮助研究人员找出代码中的哪些变化导致了不同的结果。Lab Notebook的目标是可重复性、模块化和组织性。具体来说,Lab Notebook提供以下功能:

  • 维护每次运行的元数据,包括描述、时间戳和 git 提交。

  • 自动设置运行,使用与每次运行相对应的唯一名称构建标志和目录,并在 tmux 中启动运行。

  • 将运行组织成分层类别。

  • 将运行与目录同步,以便在移动和删除运行时移动和删除目录。

安装

这个工具唯一的外部依赖是tmuxgit。之后,pip install lab-notebook

配置

该程序将默认使用.runsrc中指定的任何参数。用户始终可以使用命令行参数覆盖.runsrc文件。有关参数的描述,请使用runs -hruns [command] -h 程序在当前工作目录的祖先(包括)中搜索.runsrc文件。如果程序没有找到.runsrc文件,它将在当前工作目录中创建一个具有默认值的文件。用户可以在.runsrc中使用两个关键字:

  • <path>将替换为运行的路径。路径看起来就像普通的文件路径(/ -delimited)。

  • <name>将被路径的头部替换。

用户还可以使用语法${section:value}插入来自.runsrc其他部分的字符串。有关更多详细信息,请参阅 configparser ExtendedInterpolation

这是一个示例.runsrc文件:

[main]
root = <s>/Users/ethan/demo-lab-notebook/.runs</s>
db_path = <s>/Users/ethan/demo-lab-notebook/runs.pkl</s>
dir_names = <s>tensorboard</s>
prefix = <s>Source ~/virtualenvs/demo-lab-notebook/bin/activate;</s>
nice

[flags]
--log-dir=<s>${main:root}/tensorboard/<path></s>

[new]
description = <s>demo lab-notebook</s>

这会将标志--logdir=/Users/ethan/baselines/.runs/tensorboard/<path>传递给使用run 启动的任何程序,其中<path>将被用户提供的路径参数替换。

运行-git

这是一个简单的git包装器,它将+your-path替换为runs lookup commit your-path。例如,要查看自启动your-run以来的更改:

runs-git diff +your-run

如果你想在野外生活,当你在你的项目目录中时,使用direnv将git别名为runs-git 。

示例用法

设置环境:

mkdir ~/lab-notebook-demo/ && cd ~/lab-notebook-demo
wget https://raw.githubusercontent.com/tensorflow/tensorflow/master/tensorflow/examples/tutorials/mnist/mnist_with_summaries.py
pip install tensorflow lab-notebook
git init
echo 'runs.pkl .runs .runsrc' > .gitignore
git add -A
git commit -am init

创建一个新的运行。运行将在tmux中启动:

runs new train 'python mnist_with_summaries.py' --description='demo new command'

检查你的运行:

tmux attach -t train

重现你的运行:

runs reproduce train
runs reproduce --no-overwrite train

尝试修改.runsrc文件,使其看起来像 配置部分中的示例,并对您的系统进行适当的更改。然后创建一个新的运行:

runs new subdir/train 'python mnist_with_summaries.py' --description='demo categorization'

大致了解数据库中的运行情况:

runs ls
runs ls 'tra*'
runs ls --show-attrs

查询当前运行信息:

runs lookup description train
runs lookup commit train

runs-git : 避免输入runs lookup commit <path>一直:

echo '# Hello' >> mnist_with_summaries.py
runs-git diff +train

组织跑步

runs mv train subdir/train2
runs ls
tree .runs  # note that directories are synchronized with database entries
runs mv subdir archive
runs ls

删除运行

runs rm archive/train
runs killall

子命令

有关子命令的概述,请运行

runs -h

有关每个子命令及其参数的详细说明,请运行

runs <subcommand> -h

选项卡自动完成

如果您使用的是 Zsh,只需将 _runs 复制到fpath的某个位置。然后按 Tab 将提示您当前在数据库中运行的名称

为什么不直接使用 git?

  • 如果进程长时间运行,则很难知道给定运行对应于哪个提交。

  • 提交语句实际上是为了描述对软件的更改,而不是运行。对更改的描述实际上可能不会告诉您太多关于软件运行的动机。

  • 并非所有提交都对应于运行,因此您需要通过大量提交来查找与运行相对应的提交。

  • 通常进程依赖于特定的文件结构(例如日志目录)。手动设置和删除这些目录既费时又容易出错。

  • 提交在创建后不能按层次组织或分类。

项目详情


下载文件

下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。

源分布

lab-notebook-3.3.3.tar.gz (22.7 kB 查看哈希

已上传 source

内置分布

lab_notebook-3.3.3-py2.py3-none-any.whl (35.6 kB 查看哈希

已上传 3 6