eladrich / pixel2style2pixel

Official Implementation for "Encoding in Style: a StyleGAN Encoder for Image-to-Image Translation" (CVPR 2021) presenting the pixel2style2pixel (pSp) framework
https://eladrich.github.io/pixel2style2pixel/
MIT License
3.2k stars 568 forks source link

Use the pre-trained model for training #303

Closed Leo1412 closed 1 year ago

Leo1412 commented 1 year ago

Hi, thanks a lot for your contribution. I'm trying to perform some training using my own dataset based on the pre-trained super-resolution model. I've added the argument :--checkpoint_path = "path/to/pretrained_model". But it threw an error when I tried to start the training. Could you please explain why this happens? Thank you very much. (The error message is shown below)

Screenshot 2023-02-13 at 9 21 42 PM
yuval-alaluf commented 1 year ago

This is because you are using a generator that outputs images at a resolution of 256x256. You can load the encoder and set strict=False when calling torch.load(). Note that since the generator is different, the pre-trained encoder may produce unexpected results. If you're fine-tuning then this could be fine, but the latent space is different, so you may be better off starting without a pre-trained pSp encoder.

Leo1412 commented 1 year ago

Thanks a lot!