=4: step = float(line[2][13:]) loss = float(line[4][6:]) tr_log文件画loss图">
赞
踩
import matplotlib.pyplot as plt tr_loss = [] tr_step = [] with open("/home/zz/123/transformer.log") as f: for line in f: line = line.strip() line = line.split(',') if len(line)>=4: step = float(line[2][13:]) loss = float(line[4][6:]) tr_loss.append(loss) tr_step.append(step) plt.figure(figsize=(8,6)) plt.plot(tr_step,tr_loss,'',label="loss") plt.title('loss') plt.legend(loc='upper right') plt.xlabel('iter') plt.ylabel('') plt.grid() plt.savefig('torch_testblueline.jpg') plt.show()
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。