I am training a conditional GAN model for generating images. condition is an image
The problem is following:
Say I train my model for 15 epochs, after that I save it using:
path_model = 'path.pt'
torch.save(Generator.state_dict(),path_model)
Now I generate images using this saved model on test dataset.
I load the model using:
load_model_name = 'path.pt'
model = Generator_c() #genertor model of GAN
model.load_state_dict(torch.load(load_model_name))
model.eval()
But the result obtained using this saved model (model) and the model I can access in my current session (Generator) after 15 epochs on the same inputs are very different.
1> Result from Saved and load model (model) on left and
2> Result from Generator in the current session (Generator) on right
I have compared the two by explicitly printing:
model1.state_dict()
model2.state_dict()
both giving the same output. Can anyone help me in understanding what might be the problem here ?
Thanks