# To add a new cell, type '# %%' # To add a new markdown cell, type '# %% [markdown]' # %% from IPython import get_ipython # %% # get_ipython().system("ls -l ../logs") # %% # get_ipython().system(" cat ../logs/model_big.log") # %% path = "code-mt5.log" losses = [] steps = [] eval_steps = [] eval_losses = [] eval_accs = [] learning_rate = [] with open(path, "r") as filePtr: for line in filePtr: print(line) toks = line.split() if toks[0] == "Step...": if "Learning" in toks: losses.append(float(toks[4].split(",")[0])) steps.append(int(toks[1].split("(")[1])) learning_rate.append(float(toks[-1].split(")")[0])) if "Acc:" in toks: eval_steps.append(int(toks[1].split("(")[1])) eval_losses.append(float(toks[4].split(",")[0])) eval_accs.append(float(toks[-1].split(")")[0])) # %% import matplotlib.pyplot as plt # %% # print(losses) # print(steps) # %% print("Steps done: ", len(losses) * 100) # %% print("last 30 losses: ", losses[-30:]) # %% plt.plot(steps, losses) plt.show() # %% min_loss, at_step = 1e10, None for step, loss in zip(steps, losses): if loss < min_loss: min_loss = loss at_step = step print("min loss: {} at step {}".format(min_loss, at_step)) # %% print(eval_losses) # %% plt.plot(eval_steps, eval_losses) plt.show() # %% print(eval_accs) # %% plt.plot(eval_steps, eval_accs) plt.show() # %% plt.plot(steps, learning_rate) plt.show() # %%