model = model.train()
    best_accuracy = 0
    ...
    for epoch in range(100):
        for idx, data in enumerate(data_loader):
                        ...
        if cur_accuracy > best_accuracy:
            best_model = model
    torch.save(best_model.state_dict(), 'model.pt')

In this way, the best accuracy model is saved well?