源项目链接:https://github.com/NLP-LOVE/Model_Log
启动:
model-log
关闭:
lsof -i:6532
kill -9
from model_log.modellog import ModelLog
#nick_name:昵称,多人使用下可起到数据隔离 project_name: 项目名称。
model_log = ModelLog(nick_name='Jade', project_name='demo实体识别', project_remark='')
# model_name: str,模型名称
model_log.add_model_name(model_name='BILSTM_CRF模型')
# remark: str,模型备注
model_log.add_model_remark(remark='模型备注')
#param_dict: 训练超参数字典, param_type: 参数类型,
model_log.add_param(param_dict={'lr':0.01}, param_type='torch_param')
best_loss = 100
best_epoch = 0
if l < best_loss:
best_loss = l
best_epoch = epoch
#评估指标名称,可选择['train_loss', 'test_loss', 'train_acc', 'test_acc', 'train_recall', 'test_recall', 'train_precision', 'test_precision', 'train_F1', 'test_F1']
model_log.add_metric(metric_name='train_loss', metric_value=l, epoch=epoch)
model_log.add_best_result(best_name='best_loss', best_value=best_loss, best_epoch=best_epoch)
model_log.finish_model()
# 关闭 SQLite 数据库连接
model_log.close()