伪·魔改版fitlog
总得来说使用逻辑跟fitlog差不多
安装
pip install fitterlog
在代码中使用
首先创建一个实验
from fitterlog.interface import new_or_load_experiment
expe = new_or_load_experiment(project_name = "<project_name>" , group_name = "<group_name>")
其中 project_name 是你的项目的名称,group_name 是这个实验所属的实验组的名称。后者默认为default。
而expe代表本次实验。
在创建实验之后,再次调用new_or_load_experiment可以得到之前创建的那个实验(这个时候不需要传参数)。
记录超参数
使用ArgProxy来代替argparse:
from fitterlog.arg_proxy import ArgProxy
prox = ArgProxy() #等价于 pars = ArgumentParser()
prox.add_argument("n" , type = int , default = 0) #等价于 pars.add_argument("--n" , type = int , default = 0)
prox.add_store_true("use_cuda") #等价于 pars.add_argument("--use_cuda" , action = "store_true")
config = prox.assign_from_cmd() #等价于 config = pars.parse_args()
可以将prox赋给expe来记录超参数:
expe.use_argument_proxy(prox)
记录变量
为一个实验创建变量:
expe.new_variable("<variable_name>" , type = <variable_type> , default = <default_value>)
其中 variable_name 是变量的名称,variable_type 是变量的类型,default_value 是变量的默认(初始)值。
访问变量
print( expe["<variable_name>"].value )
更新变量
expe["<variable_name>"].update(<new_value> , time_stamp = <time_stamp>)
new_value 是新的变量值。time_stamp 是本次更新的时间戳。
time_stamp 默认为上次的时间戳+1(初始默认为0)
访问前端
使用命令fitterlog-start-server -p <port>启动服务。port 默认为8000。
使用url <服务器地址>:<port>即可访问前端。(前端的具体操作自己摸索吧懒得写了)
高级功能
-
使用
add_argument(editable = True)可以让某个变量可以在前端修改,类似于fitlog中的memo,不过更灵活。 -
一个变量可以同时记录多组值。示例:
expe["loss"].new_track("dev")
expe["loss"].new_track("test")
expe["loss"]["dev"].update(balabala)
expe["loss"]["test"].update(balabala)
使用的时候不new_track也可以,他会自动创建track。
-
使用
expe.add_line可以向前端写文字版log,相当于fitlog的fitlog.add_to_line(没错我刚刚才发现名字打错了,本来是想跟fitlog一致的) -
还有很多
功能bug自己摸索吧懒得写了
Metadata
Release files for fitterlog 0.3.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| fitterlog-0.3.8.tar.gz | 1.6 MB | Details |
Release files / fitterlog-0.3.8.tar.gz
| Download URL | fitterlog-0.3.8.tar.gz |
|---|---|
| Size | 1.6 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9754e084db69036b6639d7d1204f3109b69be8e3aa804cd1a1e0081453dc0afc
|
|
BLAKE2b-256 checksum How to use checksums |
f49a2a24b37909add03218a1ab8224848b381cfe0f62710456abac76f4baff1e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.0 pkginfo/1.5.0.1 requests/2.25.0 setuptools/42.0.1 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.6.5
|