Skip to main content

TorchJotter: Log tool for Deep Learning, developed by Fudan FastNLP Team

Project description

TorchJotter

Pypi

TorchJotter = fast + git + log, 是一款用于辅助用户记录日志和管理代码的工具,主要支持 Linux 和 macOS,也支持在 Windows 的 Git Bash 中使用。

TorchJotter中文文档

file structure

|-setup.py
|-docs
|-TorchJotter
|  |--- init
|  |--- fastlog
|  |--- fastgit
|  |--- server
|-tests
  

update schedule

filog 是我们实验室内部使用的一款工具,大部分功能口口相传,文档和教程还没有特别全。感谢大家的尝试使用,遇到问题可以在 Issues 处提出。

一些使用说明

  1. 如果在debug阶段,不希望TorchJotter发生任何作用,那么直接在入口代码处(import TorchJotter的下一行)加入TorchJotter.debug()就可以让所有的TorchJotter调用不起任何作用,debug结束再注释掉这一行就可以了。 如果希望在某一段代码不要记录,可以在这段代码之前TorchJotter.debug(flag=True), 跑出这段代码之后TorchJotter.debug(flag=True)即可恢复
  2. TorchJotter默认只有在产生了第一个metric或loss的时候才会创建log文件夹,防止因为其它bug还没运行到model就崩溃产生大量无意义的log。
  3. 如果使用了分布式训练,一般只需要主进程记录TorchJotter就好。这个时候可以通过将非主进程的TorchJotter设置TorchJotter.debug()
    import torch
    import TorchJotter
    
    if torch.distributed.get_rank()>0:
        TorchJotter.debug()
    
  4. 不要通过多进程使用TorchJotter,即multiprocessing模块。
  5. TorchJotter.commit()只需要在某个python文件调用就可以了,一般就在入口python文件即可。
  6. 传入到TorchJotter的各种参数、metric的名称,请 避免特殊符号(例如$%!#@空格),请只使用_与各种字母的组合 ,因为特殊符号可能导致网页端显示不正常。
  7. 在命令行中通过TorchJotter log logs打开网页的时候,如果出现了网页无法访问的情况,首先检查一下ip地址是否正确,例如如果是在服务器上启动的服务,在电脑这端应该用http://服务器的ip:5000 来访问,如果是在本地电脑启动的,可以尝试通过http://0.0.0.0:5000http://127.0.0.1:5000http://localhost:5000 访问。如果以上仍然不能访问,可以通过ctrl+c关闭TorchJotter服务,然后通过命令TorchJotter log logs --ip 127.0.0.1启动再试一下能不能访问。

Developing Features(2020.09.13)

以下为正在开发中的功能,API 可能发生变化。

为函数 TorchJotter.finish 增加了可选参数 send_to_bot,传入一个字符串,为飞书机器人的 webhook 地址。 使用这个参数可以让用户在训练完成时收到通知。

例如:设定 status 为 1, send_to_bot 为 webhook 的地址,可让飞书机器人发布训练发生错误的讯息。(status默认值为0,表示实验成功结束)

TorchJotter.finish(status=1,
	send_to_bot="https://open.feishu.cn/open-apis/bot/v2/hook/xxxxxxxx")      

添加飞书机器人的方法参考群聊机器人

New Features(2020.06.11)

以下的功能都没有经过实战使用检验,可能有bug。

1. 支持一些复杂筛选条件

现在支持在Table那个页面的search框中输入复杂搜索逻辑进行筛选,例如下面log

before_search

想要搜索2020年06月11号15点到2020年06月11号16点之间,并且hidden_size大于60的log, 可以通过下面的语法输入到search框中

${'id':'log_20200611_150000<=&&<=log_20200611_160000', 'hyper-hidden_size':'>60'}$

使用效果如下(只显示满足条件的log了)

after_search

其中开头结尾的$是特殊标记符号,申明这是特殊搜索,否则TorchJotter会只进行常规字符串匹配搜索。由于search框一旦有文字就会触发搜索,所以建议在其他地方把文本编辑好,直接复制到search框中。支持的search语法规则如下

  1. 支持使用list表达或的关系。比如{"hyper-lr":[0.3, 0.1]}表示等于0.3或者0.1都会显示在前端。
  2. 支持通过>,<,<=,>=表示范围.{"hyper-lr":"<0.3", "hyper-dropout":">0.5"}表示lr小于0.3且dropout大于0.5的才保留。 大于小于符号可以在条件的最右边或者最左边,即"<0.5"或"0.5>"是等价的。
  3. 支持不等式操作,例如{'hyper-dropout':"!=0.4"}则为dropout不是0.4的才会保留
  4. 使用大于小于的场景,支持通过&&表达并且如{"hyper-lr":"0.1<&&<0.3"},表示lr需要大于0.1但小于0.3。
  5. 不同column之间默认是and的关系比如{"hyper-lr": 0.1, "hyper-dropout":0.3}表示lr和dropout同时为0.1和0.3的log; 如果需要使得不同column之间为或的关系,可以通过在filter_condition中加入一个特殊的字段and_filters, 以下的条件表示是不同filter为或的关系{"and_filters":0, "hyper-lr": 0.1, "hyper-dropout":0.3}, 请通过0或1表示and_filters。 申明某个column时,它名称是从最top的header一路到最底层的header,通过-连接。例如hyper下面的hidden_size, 搜索的时候条件应该写为hyper-hidden_size。

2.支持多条log的metric收敛曲线对比

操作如下图所示,先选择需要对比的log(默认只能选择10条),然后点击右上角红色框处

compare_metric

然后会弹出选择需要对比的metric,选好需要对比的metric后点击确认跳转,跳转后界面为

compare_metric_trend

我十分垃圾的js代码能力坚定地告诉我:你们一定不可能需要对比loss曲线的,所以我就没有必要再做loss对比了🐶。

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

TorchJotter-0.9.14.tar.gz (940.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

TorchJotter-0.9.14-py3-none-any.whl (973.8 kB view details)

Uploaded Python 3

File details

Details for the file TorchJotter-0.9.14.tar.gz.

File metadata

  • Download URL: TorchJotter-0.9.14.tar.gz
  • Upload date:
  • Size: 940.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.12

File hashes

Hashes for TorchJotter-0.9.14.tar.gz
Algorithm Hash digest
SHA256 a1dbb64506926323b1ccfbea8549cd0bcd066f97b2cd6992e7ab1b649e6789aa
MD5 c6efb4605902e4cd02469479706fb636
BLAKE2b-256 49554a1f3e0870a20c97ede8eb01dc87090cbcc5bb3494d9dc8c69968e260889

See more details on using hashes here.

File details

Details for the file TorchJotter-0.9.14-py3-none-any.whl.

File metadata

  • Download URL: TorchJotter-0.9.14-py3-none-any.whl
  • Upload date:
  • Size: 973.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.12

File hashes

Hashes for TorchJotter-0.9.14-py3-none-any.whl
Algorithm Hash digest
SHA256 ba1186bfb0cbcdee123d9bacc868c1e969635d5ef1832fc4860efc0ee79e0541
MD5 1051227030bf04881217721f674f0389
BLAKE2b-256 d26c5a355e95c1e1698f29b36bd25192854d70c8b9f58e814c2d14b45fe13c58

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page