Idiotproof file operations
All checks were successful
s444409-training/pipeline/head This commit looks good
s444409-evaluation/pipeline/head This commit looks good

This commit is contained in:
Marcin Kostrzewski 2022-05-05 23:22:10 +02:00
parent 5f4b34648d
commit 5b2b990ccb

View File

@ -31,11 +31,9 @@ def main():
loss_fn = torch.nn.MSELoss() loss_fn = torch.nn.MSELoss()
loss = test(dataloader, model, loss_fn) loss = test(dataloader, model, loss_fn)
with open('evaluation_results.txt', 'r+') as f: with open('evaluation_results.txt', 'a+') as f:
f.read()
f.write(f'{str(loss)}\n') f.write(f'{str(loss)}\n')
f.flush() with open('evaluation_results.txt', 'r') as f:
f.seek(0)
values = [float(line) for line in f.readlines() if line] values = [float(line) for line in f.readlines() if line]
make_plot(values) make_plot(values)