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 = test(dataloader, model, loss_fn)
with open('evaluation_results.txt', 'r+') as f:
f.read()
with open('evaluation_results.txt', 'a+') as f:
f.write(f'{str(loss)}\n')
f.flush()
f.seek(0)
with open('evaluation_results.txt', 'r') as f:
values = [float(line) for line in f.readlines() if line]
make_plot(values)