File size: 1,558 Bytes
24de675 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# 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()
# %%
|