Lornatang / SRGAN-PyTorch

A simple and complete implementation of super-resolution paper.
Apache License 2.0
410 stars 105 forks source link

Pre-trained Discriminator model cannot load #49

Closed leminhhuy132 closed 2 years ago

leminhhuy132 commented 2 years ago

Pre-trained Discriminator model cannot load when I try to continue training with my data. Error: Load dataset successfully. Build SRGAN model successfully. Downloading: "https://download.pytorch.org/models/vgg19-dcbb9e9d.pth" to /root/.cache/torch/hub/checkpoints/vgg19-dcbb9e9d.pth 100% 548M/548M [00:03<00:00, 156MB/s] Define all loss functions successfully. Define all optimizer functions successfully. Define all optimizer scheduler functions successfully. Loading SRResNet model weights Loaded SRResNet model weights. Check whether the pretrained discriminator model is restored... Traceback (most recent call last): File "train_srgan.py", line 512, in main() File "train_srgan.py", line 76, in main d_optimizer.load_state_dict(checkpoint["optimizer"]) File "/usr/local/lib/python3.7/dist-packages/torch/optim/optimizer.py", line 146, in load_state_dict raise ValueError("loaded state dict contains a parameter group " ValueError: loaded state dict contains a parameter group that doesn't match the size of optimizer's group

Lornatang commented 2 years ago

Ok,I check it

Lornatang commented 2 years ago

This does not seem to be a problem. I guess you should use the model I provided directly for recovery training.

Lornatang commented 2 years ago

If you want to continue training on this basis, you need to comment 76, 78, 79, 96, 98, 99 lines of code.

leminhhuy132 commented 2 years ago

it worked fine, thanks for yours help