The point in the code where you are saving it could go something like this,
for e in range(epochs):
      .
      .
      .
      if e % 5 == 0:
         save_file_name = "{}_state.pt".format(e+1)
         torch.save(model_state_dict, save_file_name)
     .
     .