Machine-Learning-Collection
Machine-Learning-Collection copied to clipboard
ProGAN issues
I found 2 issues while running the pre-trained model set to 256x256, both issues are related to generate_examples function.
-
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'
-
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.
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)