更改
This commit is contained in:
@ -11,7 +11,7 @@ from tools.dataset import load_data
|
|||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
from configs import trainer_tools
|
from configs import trainer_tools
|
||||||
import yaml
|
import yaml
|
||||||
|
from datetime import datetime
|
||||||
with open('configs/scatter.yml', 'r') as f:
|
with open('configs/scatter.yml', 'r') as f:
|
||||||
conf = yaml.load(f, Loader=yaml.FullLoader)
|
conf = yaml.load(f, Loader=yaml.FullLoader)
|
||||||
|
|
||||||
@ -125,8 +125,13 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
scheduler.step()
|
scheduler.step()
|
||||||
current_lr = optimizer.param_groups[0]['lr']
|
current_lr = optimizer.param_groups[0]['lr']
|
||||||
log_info = ("Epoch {}/{}, train_loss: {}, val_loss: {} lr:{}"
|
log_info = ("[{:%Y-%m-%d %H:%M:%S}] Epoch {}/{}, train_loss: {}, val_loss: {} lr:{}"
|
||||||
.format(e, conf['training']['epochs'], train_lossAvg, val_lossAvg, current_lr))
|
.format(datetime.now(),
|
||||||
|
e,
|
||||||
|
conf['training']['epochs'],
|
||||||
|
train_lossAvg,
|
||||||
|
val_lossAvg,
|
||||||
|
current_lr))
|
||||||
print(log_info)
|
print(log_info)
|
||||||
# 写入日志文件
|
# 写入日志文件
|
||||||
with open(osp.join(conf['logging']['logging_dir']), 'a') as f:
|
with open(osp.join(conf['logging']['logging_dir']), 'a') as f:
|
||||||
|
Reference in New Issue
Block a user