How to save data inside training loop

What’s the easiest way to save data inside the training loop? I don’t want to use built in logs etc… I just want to say np.save() etc…

Since you can just say torch.save(state dict, path) in on_train_epoch_end, I assumed I could just save other data there too but it appears to be corrupt.