Machine-Learning-Collection icon indicating copy to clipboard operation
Machine-Learning-Collection copied to clipboard

ProGAN issues

Open AyadiGithub opened this issue 4 years ago • 1 comments

I found 2 issues while running the pre-trained model set to 256x256, both issues are related to generate_examples function.

  1. When Load_model = True, the model and weights are put on the CPU even though "" map_location='cuda' "" when copying weights from checkpoint. This means the random noise generated in generate_examples will give a Tensor type error: "Input type (torch.cuda.FloatTensor) and weight type (torch.FloatTensor) should be the same". Solution: torch.tensor should be device='cpu'

  2. generate_examples generates images that are basically just noise. This happens when LOAD_MODEL = True I am not able to find a solution for this.

AyadiGithub avatar Aug 24 '21 06:08 AyadiGithub

For the second issue, I think you need to explicitely load the parameters in your model before calling the function generate_examples (LOAD_MODEL should also be True, of course). The code should look like this:

import torch.optim as optim load_checkpoint(CHECKPOINT_GEN, gen.to(DEVICE), optim.Adam(gen.parameters(), lr=1e-3, betas=(0.0, 0.99)), 1e-3) generate_examples(gen.to(DEVICE), 6, 10)

L-PL avatar Aug 22 '22 01:08 L-PL