Najeh_Nafti:

and how to load the saved models?


In your code snippet you are already loading the state_dicts in:
G.load_state_dict(checkpoint['G_state_dict'])
optimizer_G.load_state_dict(checkpoint['optimizer_state_dict_G'])




 Najeh_Nafti:

Using this technique, during the training I got the same loss for different epochs.
Where is the problem?


Check that gradients are calculated for each used parameter after the first backward pass. If some .grad attributes are set to None, your computation graph is detached. If that’s not the case, try to overfit a small dataset by playing around with hyperparameters.