I run the Deep Learning program to preserve the trained weights. Using pytorch. Save () to save, but an error occurs when this program is run.
This is an error that occurred while I was running
RuntimeError: Parent directory ./checkpoints/informer_powerdata2021_ftMS_sl192_ll96_pl48_dm512_nh8_el2_dl1_df2048_atprob_fc5_ebtimeF_dtTrue_mxTrue_test_0 does not exist.
Here is my code
torch.save(model.state_dict(), path+'/'+'checkpoint.pth')
This is what my path looks like
'./checkpoints/informer_powerdata2021_ftMS_sl96_ll48_pl24_dm512_nh8_el2_dl1_df2048_atprob_fc5_ebtimeF_dtTrue_mxTrue_test_0'
However, after the error occurred, I went to check the checkpoint folder.I found that the informer_powerdata2021_ftMS_sl96_ll48_pl24_dm512_nh8_el2_dl1_df2048_atprob_fc5_ebtimeF_dtTrue_mxTrue_test_0 folder had been created, but it was empty.
I don't know why the folder was created but the error occurred that the parent directory does not exist. I search and find out that someone said torch.save () seems to presuppose either mkdir or makdirs, and can not be saved directly to the immediately specified folder.
But when I run the model's original data, it can create and save the folder directly in the checkpoint directory